Trouble giving Weapon/Armor/Item[<Variable X>]

Hey all,

I've got a pretty simple question, scanned a few forums and couldn't find the answer. I've set up a system where an item/weapon/armor is stored in variable 101, and it's then passed back to a local event, which then uses that variable to know which item/weapon/armor to give the character.

i've set up a case handler to determine whether we're firing the give item, give weapon, and give armour command. the code i'm executing on giveItem is as follows:

$gameParty.gainItem($dataItems[$gameVariables.value(101)], 1);

now, this code works as intended. it looks up variable 101, goes, 'okay, V101 is 25, you want item 25', and gives it to you. but i can't find the equivalent commands for weapons and armors. here's my guesses:

$gameParty.gainArmor($dataArmors[$gameVariables.value(101)], 1);
$gameParty.gainWeapon($dataWeapons[$gameVariables.value(101)], 1);

they both don't work. throw error undefined and the console complains. does anyone know the correct commands for these two?
AFAIK it is still gainItem, but instead of $dataItems as a parameter, you put $dataArmors or $dataWeapons


so it will be


.gainItem($dataArmors[ID],amount)
Works! Thanks so much. Was about to call it for the night, i suppose I'll keep working now 😀
In case someone finds this in a google search in the future, the correct commands to give an item/weapon/armor based on a stored variable are:


$gameParty.gainItem($dataItems[$gameVariables.value(ID)], amount);


$gameParty.gainItem($dataWeapons[$gameVariables.value(ID)], amount);


$gameParty.gainItem($dataArmors[$gameVariables.value(ID)], amount);


Have fun not doing those loot tables manually 😉

Original thread: https://forums.rpgmakerweb.com/threads/trouble-giving-weapon-armor-item-variable-x.74018/