How do I search an Array for a index and set it to 0?

Get help using Construct 2

Post » Sun Aug 20, 2017 1:25 pm

Title is self explanatory, I'm using an array for a Final Fantasy style combat system. At the beginning of the turn it maps who's alive and stamina they have, depending on the stamina stat the array orders it into who attacks. After the unit attacks, the array shifts down until everyone has attacked.

However if a unit dies before it has had it's turn I want it to be removed from the array since y'know it can't attack anymore. I know the event to search the array for index containing the value i'm looking for. But when I go to set the index how do I reference the index that has been located in the conditions? I want to to use the "Set X" action.

Any help would be appreciated.

Link to a visual example of my problem here:
http://imgur.com/a/845C9
Last edited by PixelatedTrip on Sun Aug 20, 2017 3:45 pm, edited 1 time in total.
B
7
Posts: 28
Reputation: 337

Post » Sun Aug 20, 2017 3:14 pm

Hey Pixel,

If you know what the name of the index is you are looking for in an array, you can target the column by using

array.Indexof("name")

So if you want it removed from the array you just use the delete action from the array object, then set the X to be the above.
ImageImage
B
130
S
23
G
7
Posts: 1,078
Reputation: 13,280

Post » Sun Aug 20, 2017 4:19 pm

This fixed it, thank you very much sir.
B
7
Posts: 28
Reputation: 337


Return to How do I....?

Who is online

Users browsing this forum: tannerdler and 28 guests