I am just learning GDevelop and one thing I struggle with is the concept of array variables.
Here is what I want the system to do:
On Click of a button, the system will generate a random number from 0-100 and return a text string to a player.
Arrays use 0, so I need to account for that.
Imagine that the strings are:
- Gold Bar
- Silver Bar
- Bronze Bar
- Iron Bar
4-100: Return nothing to the player (no text/no object)
On 0-3 an instance of the appropropiate object goes into their inventory as true. They can only have one of each object at a time.
Let’s say this time the button was pressed and the player got a 1 and the system gave them a silver bar.
Now, there is no silver bar.
Is there a dynamic way without creating every possible variation of an array, so that I can have the system write logic to change the array?
- Gold Bar
1.Bronze Bar - Iron Bar
3-100: Return nothing to the player (no text/no object)
Can I do something like that? if so, how.
The practical application of this for me will be much more advanced, but once I learn the basics, I can do it.
Basically, imagine a game where the player is a King and I want to determine the type of Courtiers that attend him at court to settle a matter. If I have a unique event where this can only happen once, will want to dynamically reshuffle the array so that that event is no longer possible, and possibly other events are MORE likely now.
I will eventually design the game, so that certain types of events are more likely to occur, or not occur at all based on condiitonal logic. IE: if the King follows the “Old Ways” versus the “New Gods” I might make an event not trigger at all, and another one more likely.
Learning to create a dynamic array is essential (I think).






