- 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:
I then move the equipment this actor is wearing in the group inventory:
Then I swap the actor:
All of this above works. Where I'm stuck is with this:
Get the newly added Actor2 to wear the equipment
The above just doesn't seem to do anything... actor start empty handed
What am I missing here?
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);
}
};
What am I missing here?
Last edited:
