[RMMV] Remove weapons/armor and then re-equip

Moon_Haven

Veteran
Veteran
Joined
May 5, 2020
Messages
126
Reaction score
47
First Language
Français
Primarily Uses
RMMV
Edit: I should mention that I'm using Yanfly item core...


What I want to do:
1- Remove equipment from an actor, place in inventory
2- Swap an actor
3- Put the removed equipment onto the actor


I'm starting with saving what the actor is wearing into game variables:
JavaScript:
for (var slotId = 0; slotId < 7; ++slotId) {
    if ($gameActors.actor(actorId).equips()[slotId]) {
        $gameVariables.setValue(24 + slotId, $gameActors.actor(actorId).equips()[slotId].id);
    } else {
        $gameVariables.setValue(24 + slotId, 0);
    }
};

I then move the equipment this actor is wearing in the group inventory:
JavaScript:
$gameActors.actor(actorId).clearEquipments();

Then I swap the actor:
Code:
Change Party Member : Remove Actor1
Change Party Member : Add Actor2

All of this above works. Where I'm stuck is with this:

Get the newly added Actor2 to wear the equipment
JavaScript:
for (var slotId = 0; slotId < 7; ++slotId) {
    var idItem = $gameVariables.value(24 + slotId);
    if (idItem > 0){
        var actor = $gameActors.actor(actorId);
        actor.forceChangeEquip(slotId, idItem);
    }
};
The above just doesn't seem to do anything... actor start empty handed



What am I missing here?
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Staring at all the RPG Maker versions I have and realizing that my project has been a long time coming. But, I finally feel like I have the knowledge and experience to make it into something good.
We're almost done with the jam game! :D
I get scam calls all the time so today I gave them a piece of my mind. They hung up on me. Sweet revenge.
There’s a beehive in my wall

Forum statistics

Threads
104,319
Messages
1,005,526
Members
135,841
Latest member
Rixxus
Top