Instead of naming your units so you can reference them in scripts or triggers, place them in an array.
First, define the array variable, either in init.sqf or init line of an object.
(If using the object init line make sure it's the first or one of the first objects placed in the mission, this matters as objects are loaded in order. I found this out by moveincargo'ing a unit into a truck before locking specific seats in that truck and the unit would be moved into the locked seat until the order in which I placed the objects in editor was changed.)
Then in the inits of objects you want to add to this array:
Then refer to the array when checking these units for the states, such as being alive:
In case of checking soldiers, I still recommend using groups, but this is useful for vehicles/objects.
First, define the array variable, either in init.sqf or init line of an object.
(If using the object init line make sure it's the first or one of the first objects placed in the mission, this matters as objects are loaded in order. I found this out by moveincargo'ing a unit into a truck before locking specific seats in that truck and the unit would be moved into the locked seat until the order in which I placed the objects in editor was changed.)
Quote:targetArray = [];
Then in the inits of objects you want to add to this array:
Quote:0=targetArray pushBack this
Then refer to the array when checking these units for the states, such as being alive:
Quote:{alive _x} count targetArray == 0
In case of checking soldiers, I still recommend using groups, but this is useful for vehicles/objects.