Need some event help with this final detail

So I thought I had my event figured out but I didn't fully complete my thought and now I'm stuck. I have an event that has players place all their items and equipment into a locker. When the equipment is removed I have a script call that is placing the equipment id numbers into separate variables.

My goal after this was to eventually have the player come back to the locker and retrieve their items. Which is working wonderfully, but I would also like them to re-equip the equipment based on the stored variable ids. So basically I need to find a way to "change equipment head to variable id", "change equipment weapon to variable id"... and so forth for the other slots.

The only way I've been able to think up so far is using a whole bunch of conditional branches and I really don't want to have to do that. Does anyone know of a script call or some other way to achieve this? My thanks to anyone who took the time to read this, solution or not 🙂
If you put each equipment id into a variable (so one variable for head, one for body, one for shield), you can then use the script calls to re-equip them, using the variable for the id, rather than lots of conditional branches. You have to give it back to the player first, so it's in the inventory, and then you use the equip command.

Let's say you put the weapon id into variable 5 (or set it to 0 if there's no weapon equipped). This script call will add it back to inventory and equip it.

Code:
$game_party.gain_item($data_weapons[$game_variables[5]], 1)
$game_actors[actorid].change_equip_by_id(0, $game_variables[5])

You might need to hardcode the actor id, unless you have a set of variables for each actor and you're storing the actor id in a variable as well.

In the change_equip_by_id method, 0 is weapon, 1 is shield, 2 is head, 3 is body, 4 is accessory. That might change if you have a script to change or give extra equipment slots. It might also be a bit more complicated if you have two weapon slots.
If you put each equipment id into a variable (so one variable for head, one for body, one for shield), you can then use the script calls to re-equip them, using the variable for the id, rather than lots of conditional branches. You have to give it back to the player first, so it's in the inventory, and then you use the equip command.

Let's say you put the weapon id into variable 5 (or set it to 0 if there's no weapon equipped). This script call will add it back to inventory and equip it.

Code:
$game_party.gain_item($data_weapons[$game_variables[5]], 1)
$game_actors[actorid].change_equip_by_id(0, $game_variables[5])

You might need to hardcode the actor id, unless you have a set of variables for each actor and you're storing the actor id in a variable as well.

In the change_equip_by_id method, 0 is weapon, 1 is shield, 2 is head, 3 is body, 4 is accessory. That might change if you have a script to change or give extra equipment slots. It might also be a bit more complicated if you have two weapon slots.

Thank you so much! This is exactly what I needed and it works wonderfully. You helped me with another issue I had on this project about a year and a half ago and I am very grateful for your help again.

Original thread: https://forums.rpgmakerweb.com/threads/need-some-event-help-with-this-final-detail.78249/