ForEachLoop check number of instances of a variable and execute based on amount

Ok, this is a turn based prototype I’m working on. When a turn based character in the battle map “dies” it calls the “RemoveCharacter” event in my GameMode. This gets a reference to the character instance and removes that character from the array of other characters. As seen below:

At the end of every “turn” each character calls the GameMode to do various things, one of them being a Victory Check.

I am unsure why this does not work as the RemoveCharacter function in the first screenshot is ALWAYS being called before the CheckVictory function below. The idea is there are likely only two teams (player vs. ai) in each match. After every turn we want to check if the number of teams is <=1 since that means someone must have won.

Thanks for any help.

OH MY. It was a member variable and it should’ve been a local. I rewrote it in a new function and created a new local variable “Number of Teams” array and now it’s acting as intended. Thank you so much. Clearly I’ve been working too hard.

Thanks thanks thanks. I will drink a beer tonight in your honor. <3

Thank you very much again!

Is the “Number Of Teams” array a local or member variable?
And if it is a member variable does it ever get cleared?