Adding high quantity of items into inventory

Hello Everyone,

its my first post and in my first game, actually i would like to thank all who contributed to GDevelop and the GDevelop Devs who made the program into live !, super program i would say.

i was asking if there is another way to add quantity of items (1 million coin for selling an item for example) instead of looping 1 million time, it has my game paused and crashed.
hope there is a way :slight_smile:


Hello, that should be easy actually.
If you use a variable to determine how much an item costs, then when you sell it, set your money variable to use Add To on the variable of the item costs.
If your object is called building and your cost variable is valueItem, you can reference the variable by putting building.Variable(valueItem).

If that explanation doesn’t help you, try reading the wiki:
Or, post screenshot of your events for when you are selling the item.

Thanks cat for your reply,
you gave me an amazing idea of using the variables instead of inventory system, i will try it.

however in the inventory system to add an item with quantity you need to add the Repeat event with the variable quantity you specified which make the crash.

there is no way to add an item to inventory with quantity other than Repeat event?
removing the inventory system will be a pain but i will try and let you know.


Since gold is one type, you can just use global variable instead, that is how most games do it.
If you are using based on ddabrahim’s template, I cannot say, I haven’t finished explored the inventory system much yet.
If you manage to solve your problem without using inventory system feel free to mention how!

Hey Cat,
replacing the inventory with variable would have taken much time, i though, no body puts his gold with troll heads :smiley: , so i replaced only coin and made the inventory linked to it, selling or buying would have an action on the GlobalVariable(Coins) either add or subtract, that solved my issue though i cant see the gold in inventory.

Thanks :slight_smile:

1 Like