How do I create array in actions?

How do i create the array in the actions?
I tried common ways, strange ways, bigbrain ways, but all of these wasnt the right.

1 Like

Can you post the events that aren’t working? People will be more willing and able to help if they have a starting point. Otherwise, it’s just a lot of guessing.

What type of an array? A simple array or an array of structures?

Make sure to set the variable as an array in the appropriate setup screen for global, scene or object.

You can then use one of the array actions to add the value or variable. If you want to set a specific index then you can use

variableName[#] The # can be a number, variable or any expression that returns a number.

https://wiki.gdevelop.io/gdevelop5/all-features/variables/#accessing-child-variables-in-structures-or-arrays

This might also help.

The thing is, nothing works. I tried different things (and deleted everything later, I have nothing to provide from the events, I forgot how to do everything that I came up with and deleted)
A simple array.
So well… I need to create an array using an action…

Add a variable either as a scene, global or object. This uses a scene variable name List. Value and Index are used in a for each child to display the values in a text object.

You can then add either a variable or value as a number, string or Boolean to the array. The array should use just 1 type. This uses a string.

If you wanted to add a value from an object to an array, it would be something like this. This adds the animation of the object that is clicked.

This is it at runtime.
ScreenRecorderProject6

1 Like