Hello,
I am trying to use a common event to change a characters weapon when a state is applied.
So for example: Using a bow. Sate is applied that forces a switch to a specific sword. (This bit I can do)
but what I cant figure out is how, when the state is removed/end of battle, to switch it back to the bow they were using.
I am guessing it has something to do with .weapon? How would I do this?
The hardest part will be figuring out how to detect when the state is removed and how to call a common event at that time. I do have my State Add/Remove Commands script (search for it) but it doesn't appear to work under certain circumstances.
The script command in question is $game_actors[x].change_equip(slot_id, item) where slot_id is 0 for weapon for 1-4 depending on armor, and item is $data_weapons[n] or $data_armors[n] and you can get the currently-equipped weapon with $game_actors[x].equips[0] - note that it will be stored as an "item" (full object) not as an "id".
Like Shaz mentioned, one of the hardest parts will be making your game know when to look for "this state is no longer applied, switch back to the equipped weapon". If you're doing a lot of this kind of thing, then I would recommend having a Common Event (Autorun or possibly PP) require a Switch to process, and having that Switch turn ON only at the start of each battle. Therefore, when you leave the battle, it will automatically run the event and look at (among other things, if you want) whether any of the characters need to have their weapon reverted to normal.
There are a few other caveats with this, but it's something we can handle later if you are comfortable with this general approach and can get it working.