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

Moon_Haven

Veteran
Veteran
Joined
May 5, 2020
Messages
167
Reaction score
64
First Language
French
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

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,088
Members
137,585
Latest member
Reversinator
Top