In the level the Two Flowers I wanted to command my soldiers with a function but the peasant is also a friend so is there a way to filter the peasant out of the array since I do not know the place in the array(otherwise I would manually remove it)
hector is a different type than your soldiers
I know that I want to know how to remove him from the array
If you are using find friends why do you want to run over the array twice, once to remove hector and once to tell your soldiers what to do. (which was what my answer is saying: hector is of a different type . . . so ignore type of hector and do what ever with the rest.)
If you only have one type of soldier use the find by type “soldier”. then hector is never in the array.
If you have more than one type of soldier, there is a good chance you are telling them to do different things based on type so either go back to #1, or put each type into a different array, and there again, no hector.
You never say what language you are using so don’t really want to know a (specific language) coding answer, and yet you reject the general case non-coding answer.
(baby in my arms, can’t write much)
Okay then I want to know how to remove hector from the array in JS
looks like you want to pretend the array is a piece of movie film and splice that bad boy right out of the picture.
To tell you the truth I kinda want to
Okay thank you Vlevo
I used the following command to remove the first element knowing that hector will always be first
Does it actually work? There are some bugs around API protection that might be messing that up in some cases, where you can’t always modify an array that you get as a return value from a function.
Well it worked without error for me