Checking a specific index has the same name or not from an array list

Hey, so I made an array list, and I want to check if the index will have the same value or not

So for example, if the index(0) value is indeed DoubleJump, then I want to do this Double Jump Skill function

So basically i want the foreach loop to search for an index that have the specific value I wanted and if it’s true then it will do the funciton

You don’t even need a loop. Arrays have the ‘contains’ and ‘find’ nodes, which do exactly this.

image

Oh LOL, found it. Turns out it was as simple as that. Thanks!

hey, another quick question, how do i add only one item in the array?


I did this, and I think the Skill Row Name ID just fill up all the array list

Because I tried to print the find Array value, and when it doesn’t find it it’s result in -1 (which is correct)
but somehow when it finds the value, it prints in 5 (the total index of my array)

Several ways.

  1. Use ‘contains’ to check if it’s in there first, if not, then add it

  2. Use a map instead of an array, you can only add things once to a map

:slight_smile: