I decided I wanted to massively cut down the time it takes for me to make random loot systems by replacing a chain of Conditional Branches with a single Script that adds an item to the player's inventory where the ID of the item is the value stored in a variable. I was using " $gameParty.gainItem($dataItems[$gameVariables[5]], 1);" but it's not working. The full event can be seen in the screenshot below, and if I replace the script part with a series of conditional branches which checks the value of Variable 5 it works fine, just not here. What am I doing wrong? The Looping works fine, so I don't think it's that.
Thanks for any help you can give me!
The event runs upon using an item named Foci Bag from the inventory, and is supposed to add 3 randomly decided foci to the player's inventory.
FociLevel >= 1 is checking to see if the player is on Large Foci or Small Foci. At the moment, only Small Foci Bags exist so I haven't written the Large Foci Bag part yet.
First it generates a random number between 21 and 28. 21 - 28 are the item IDs for the 8 different kinds of Small Foci.
Then it's supposed to add the item with ID equal to the random number.
Then it adds 1 to the Spare Variable which determines how many times it needs to loop again in order to gain 3 items.
Thanks for any help you can give me!
The event runs upon using an item named Foci Bag from the inventory, and is supposed to add 3 randomly decided foci to the player's inventory.
FociLevel >= 1 is checking to see if the player is on Large Foci or Small Foci. At the moment, only Small Foci Bags exist so I haven't written the Large Foci Bag part yet.
First it generates a random number between 21 and 28. 21 - 28 are the item IDs for the 8 different kinds of Small Foci.
Then it's supposed to add the item with ID equal to the random number.
Then it adds 1 to the Spare Variable which determines how many times it needs to loop again in order to gain 3 items.