Save actor current weapon, swap it, then back.

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?
Have the following script calls in the common event:

  1. $game_variables[x] = $game_actors[n].equips[0].id  or  $game_variables[x] = $game_actors[n].equips[1].id      This should store the current weapon's id held by actor n into the x variable of your choice equips.[0] Is for the weapon and equips.[1] is for the shield
     
  2. $game_actors[n].change_equip(0,$data_weapons[y]) or $game_actors[n].change_equip(1,$data_weapons[y])   This should change the weapon of the actor under the n id number to the weapon with the y id number. Again, 0 is for the weapon slot and 1 is for the shield slot.

When you want to re-equip the previous weapon use this:

$game_actors[n].change_equip(0,$data_weapons[$game_variables[x]]         Where n is again the id number of the actor and x in the  same you used before

Original thread: https://forums.rpgmakerweb.com/threads/save-actor-current-weapon-swap-it-then-back.40226/