Adding item with variable ID

Status
Not open for further replies.

dombo813

Veteran
Veteran
Joined
May 3, 2014
Messages
42
Reaction score
3
First Language
English
Primarily Uses
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.
 
Last edited by a moderator:

mrcopra

Veteran
Veteran
Joined
Jul 21, 2015
Messages
449
Reaction score
149
First Language
Not English
Primarily Uses
N/A
$gameVariables.value(5)
 

dombo813

Veteran
Veteran
Joined
May 3, 2014
Messages
42
Reaction score
3
First Language
English
Primarily Uses
Brilliant, thanks a lot!
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I couldn't have Taco Bell, so I grabbed a giant piece of strawberry cheesecake instead.
Guys one of our Animal Crossing Villagers (Sherb) just told us that he hoped that the villager who was having her birthday had as memorable of a birthday as his sixth birthday. Which was "the one where the clown went into our house and never came back" and that "his mother says she still sometimes hears the honking in the walls".
My tutor has been furloughed for 8 weeks. If we are too... sucks, but it's a lot of game making time...
Social distancing extended for another week. Personally I'm cool, but this is depressing.
GOOOOD MOOORNING!
APRIL WILL BE BETTER!

Forum statistics

Threads
95,573
Messages
930,178
Members
125,855
Latest member
U_do_Dad_Jokes
Top