Unequip all equipment?

Heyo!

I need some way to clear the equipment of all actors - not just deleting it but basically
putting back all the equipped items in the inventory, is there some Script or Plugin
Command I could use for that?
I am making a sorta rogue like game, and there are permanent and temporary items, if you die
I want the player to keep all permanent items while everything temporary gets removed.
My idea was to check all permanent items with a variable and how many exist, then remove all
items from the inventory and then readding all the permanent items (which got counted with variables).
The problem is that when setting a variable to game data of some equipment in posession is that
it won't count equipped items, so before I do that I would need to uneqip everything so that
in case the player wears a permanent item its in his inventory again and gets counted correctly.

hopefully someone can help me out!
bb ~
If you want to do it via script call:

Code:
$gameParty.members().forEach(function(member) {
  if (member) {
    for (var i = 0; i < member._equips.length; i++) {
      if (member._equips[i]) {
        $gameParty.gainItem(member._equips[i].object(), 1);
        member._equips[i].setObject(null);
      }
    }
  }
});
the event command "change equipment" can also be used to unequip (set to "none").
the event command "change equipment" can also be used to unequip (set to "none").

True, but it's not as easy to have the party gain whatever item a party member has equipped in a given slot using event commands. The only way I can think of to achieve it without any Javascript is to have a conditional branch for every hero for every piece of equipment in the database being equipped, which is obviously ludicrous. As soon as you get to the point where some Javascript is required (which I'd say is the case here) you're probably better off just doing the whole thing in a quick forEach function (because for some unfathomable reason event commands have no support for iterating through the database)
wow such a quick reply! thanks trihan , I'll try it out asap 😀

EDIT: its working perfectly! nice <3

Oh btw- is there a way to empty the inventory?
maybe even in specific, like "empty key-items" ?
If not I'll just do it all by hand, but considering my game has like 100s of items
it could save me a lot of time and work 😀
The only way I can think of to achieve it without any Javascript is to have a conditional branch for every hero for every piece of equipment in the database being equipped, which is obviously ludicrous.
You didn't read the original question - this topic is about unequipping.
You don't need conditional branches to unequip, and you don't need a different command for each item either.
You only need a series of one command per actor and per equipment slot to unequip everything.
You didn't read the original question - this topic is about unequipping.
You don't need conditional branches to unequip, and you don't need a different command for each item either.
You only need a series of one command per actor and per equipment slot to unequip everything.

My mistake, forgot that unequipped items go to the inventory anyway. It's still quicker with a script call though. 😉

Edit: To remove non-key items from the inventory, use this snippet:

Code:
Object.keys($gameParty._items).forEach(function(item) {
  if ($dataItems[item].itypeId === 2) {
    delete $gameParty._items[item];
  }
});

If you also want to do weapons and armours, you can use the same snippet, just replace _items with _weapons or _armors and $dataItems with $dataWeapons or $dataArmors respectively.

Original thread: https://forums.rpgmakerweb.com/threads/unequip-all-equipment.75198/