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

Moon_Haven

Veteran
Veteran
Joined
May 5, 2020
Messages
123
Reaction score
46
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


Todo:
Add fog of war
Add enemy indicators
Make window draggable
Optimise map drawing algorithm (5 seconds to load the map you see, so it's a... poo-poo algorithm)

Any suggestions? :kaoblush:
bleh studio hell job haha at least they like it didnt had time to do much laundry tho ;w;'....YES I DO AT LEAST TAKE A SHOWER everyday!
Ami
--- Food Ingredients ---

Hero: Since the Chef are in Hospital,we can't eat his Dish in 3 Days.
F.Mage: What we have to Eat?
M.Healer: Don't worry,we can Eat the Food Ingredients.
Hero & F.Mage
: Really?

(3 Days Later)

Chef: Hi,Guys. I'm Ba---
(Entire Party Collapse After Eat Raw Meat)
Chef: Wha...WHAT GOING ON HERE!!!!!!
So, I've been thinking about all the complaints about the chibi sprites. Is the problem that they're chibi or that they don't match the character art? If I did a series of chibi/SD character art, would people be interested?
Converting a timer plugin from MV to MZ. Now I really start to fell how awesome the new plugin commands are. This really helps create plugin easier than before!

Forum statistics

Threads
102,908
Messages
995,899
Members
134,357
Latest member
Ale_16
Top