Script Help

Hello Everyone!
Hope you all had a great holiday 🙂

So I realize to take away a party's inventory i could use variables to take it all away with giving it back eventually
(standard prison escape affair here)

I saw there was an easy script for VX, is there an easy one for MV?

To take away and store
$game_variables[99] = {}
($data_items + $data_weapons + $data_armors).each{|i|
$game_variables[99] = $game_party.item_number(i)
$game_party.lose_item(i, $game_party.item_number(i)) }


To get back
$game_variables[99].each{|i,a| $game_party.gain_item(i, a)}
You may be interested to check out the "RPG Maker MV School" lesson on console use. If I remember correctly, there was a part where the party's items get taken away, you could study that to see how it was done.

https://forums.rpgmakerweb.com/index.php?threads/lesson-about-console-use.85264/

I've moved this thread to Plug-In Requests. Thank you.

Are you sure you've got that entire script correct? I don't think it would work the way you've got it. Looks like some of the code was converted to formatting.

You would need to link back to the original post you took it from, or copy it from the original and paste it into CODE tags so the text isn't converted.
Are you sure you've got that entire script correct? I don't think it would work the way you've got it. Looks like some of the code was converted to formatting.

You would need to link back to the original post you took it from, or copy it from the original and paste it into CODE tags so the text isn't converted.

https://forums.rpgmakerweb.com/index.php?threads/inventory-confiscation.72524/

that is the page i found it
Bump
There's probably a better way, but this will work.

Code:
//Store the items, weapons, armors into variables
$gameVariables.setValue(21, $gameParty._items);
$gameVariables.setValue(22, $gameParty._weapons);
$gameVariables.setValue(23, $gameParty._armors);
//Take away the items, weapons, armors
$gameParty._items = {};
$gameParty._weapons = {};
$gameParty._armors = {};

Code:
//Give back the items, weapons, armors
Object.keys($gameVariables.value(21)).forEach(function(key) {
$gameParty.gainItem($dataItems[key], $gameVariables.value(21)[key]);
});
Object.keys($gameVariables.value(22)).forEach(function(key) {
$gameParty.gainItem($dataWeapons[key], $gameVariables.value(22)[key]);
});
Object.keys($gameVariables.value(23)).forEach(function(key) {
$gameParty.gainItem($dataArmors[key], $gameVariables.value(23)[key]);
});
//Reset the Game Variables
$gameVariables.setValue(21, 0);
$gameVariables.setValue(22, 0);
$gameVariables.setValue(23, 0);
Works like a charm! Saved my butt sir!

Original thread: https://forums.rpgmakerweb.com/threads/script-help.88933/