Seriously, with pick by evaluate ....
web example
capx
I applied it as a 1 time even on layout start, but you can plan it anyway you like, timed events or trigger whatever.
2 indicates dead units, dead units are black, living ones blue
It runs the for each loop once, only picks the objects with value, addds numbers and sets animation frame depending on each spawned objects "dead" variable.
I make them text strings noadays, defining yes or no, I ran into a few issues with booleans (have this in other languages too) and prefer to resort to strings or numbers.
Anyway, hope you can adjust to fit your needs :)