So, I’m working on enemy waves, and for a reason I do not understand, “ISVALID Index” when set to “1” comes as true when there are two enemies left (I understand why), and when set to “0” is true when there’s one enemy left.
How do I check for no enemies left? I tried “-1”, you know, to be cute, and Unreal was like, “heeeeellll no, noob.”
First, thank you for showing me the easier looping way, because the one I create without the “for loop” function was treacherous.
My concern is that it will pass a value as “not valid” before ALL enemies are destroyed.
To be clear:
Enemies 1, 2, 3 are dead, but 4 and 5 are not.
If I have a condition on the other side of the loop, would it go through as “Invalid” at some point, even though 4 and 5 still exist? (They’re using the same blueprint, which is the issue.)
it should not go as “Invalid” if enemy 4 and 5 still exists. Has it happened before?
They’re using the same Blueprint but “get all actors of class” node gets an instance of an actor of particular class, so it is checking on individual level.
I was just analyzing the code.
I will try it tomorrow, when I’m thinking more clearly, and promote your answer as “solution” should it behave identically to my solution.
I really don’t like using “get all actors of class”, but if you must, why not just check if the returned array is empty to know if there are enemies left?