Script call to equip weapon

● ARCHIVED · READ-ONLY
Started by Shinma 7 posts View original ↗
  1. Hey guys, this is probably an easy one for for. I would like to use the script function to make a character equip a specified weapon.

    I know this is technically doable through the change equipment --> weapon button, but due to how my game is set up characters do not have the ability to equip anything at first. During some dialog the character gains the ability to use specific gear, but I would like for it to auto-equip the weapon for him. 

    Thanks!
  2. Moving to VX Ace Support (as you do not need to do this via script at all)


    Change Equipment is exactly what you need to use. What's so special about your game that that command won't work?


    By "characters do not have the ability to equip anything at first", do you mean the type of equipment is not listed in the features slot for that character? That is an entirely different issue, and equipping via a script call is not going to solve it - whether you use the event command or the equivalent script call, the character MUST be set up to be able to equip that weapon.


    If that's the case, search for my Dynamic Features script, which will allow you to add a feature enabling the character to equip that weapon at the correct point. And then use the Change Equipment command to automatically equip it.
  3. Hey Shaz, thanks for the move, I was iffy about where to place it.

    I had a custom script made that ties in weapon equips through a skill tree. At one point, during conversation, a character chooses the type of weapon they would like to use. They are then given the weapon and the first skill of that skill tree.

    If I use change equipment --> weapon and then click on the weapon drop down, there are no weapons listed there.

    The problem with using your script is that I want to equip the weapon within the same event page.

    Here is a rough example:

    NPC, "Shinma, choose the weapon type you would like to equip."

    Shinma, "I choose to use one handers."

    *Shinma has learned to use one handed weapons.*

    *Shinma has been given a one handed short sword.*

    *Shinma has equipped the one handed short sword.* <-- at this point, since I am just now getting the ability to equip 1 handers I cannot use the change equipment to select a weapon.
  4. Archeia put together this handy list of script calls and I think you could use its Change Equipment call to accomplish what you're trying to do here:

    $game_actors[id].change_equip_by_id(slot, equip) if $game_actors[id]

    Additional notes on that command can be found in the thread that I linked you to.

    I haven't tried this myself, but I imagine it should work, especially if you're giving them a state beforehand that allows them to equip the specified type of weapon, or adding Shaz' Dynamic Features script.
  5. Try setting a self switch and on a "second" event page, start the adding of the equipment?

    i.e. ON the first page use the learn equip type, then on the second page (via a self switch) use the change equipment event (or use the advanced --> script option that Wavelength mentions).

    OK, on second thought (I just checked the eventing). You will need to use the script calls to both add the add equip abilities, and to equip the items.
  6. You may just need to add the equip type to the actor to begin with, so the weapon is available in the list to choose from. Once you have the event all set up, you can go back and remove the equip types from the features. But if it's a weapon they will be able to carry around and you don't want them to be able to equip it, you WILL need to use the script to give them that equip type feature prior to attempting to equip it.


    Hope you understand what I mean by that first sentence ... give the actor the equip type feature, set up the event with the Equip Weapon command which should let you choose the weapon, then remove the feature again. If you ever want to edit that event command, you'll need to temporarily give them that feature again and remove it afterwards.
  7. Wavelength, that worked perfectly. Bookmarked that handy thread by Archeia, too.

    Shaz, I think yours would have worked as well. Essentially grant the character the ability to equip it inside the database, then remove that ability inside the game until it is given at the correct time.

    Voymasa, thanks for the brainstorming!

    Thread can be closed as this is solved now. Thanks, everyone!