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

0 favourites
  • 3 posts
From the Asset Store
Easy to use shop and inventroy populated by an array!
  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • This fixed it, thank you very much sir.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)