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

Moon_Haven

Veteran
Veteran
Joined
May 5, 2020
Messages
124
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

A good way to mix your own music? What's the learning curve on that?
Would it be better to pay a composer?
What theme for the next windowskin? You'll decide. Tell what you wanna see and I'll try for.
I just saw in a manga an interesting mechanic - setting up a stationary teleport beacon that one can go to no matter where one is in a dungeon. I think it'll work with a similar setup to how I did my airship transition.

Ooh what if you could set up multiple beacons and choose from a list of the beacons you set up?

Hmm...
Actor2_1 added!

Is the running performance of MZ output to Android platform smoother than MV output?

Forum statistics

Threads
103,255
Messages
998,370
Members
134,750
Latest member
brainson0815
Top