uurgh, more stuff to struggle to understand
i had a feeling i was making things difficult for myself, much thankage for your suggestions
i tried to simplify the earlier version, it doesnt work but if it did i think it would do exactly what i want: check that certain units, if not dead, are loaded on a truck
_unit1 = _this select 0
convoyloaded = 0
_a = 0
_l = 0
;a=aliveunitcache, l=loadedunitcache
?(alive _unit1): {_a=_a+1} else {_a=_a-1}
?vehicle _unit1 != _unit1: _l=_l+1
@"_a == _l":convoyloaded=1
I get the feeling i should be doing something easier =/
what i think the code does is this: counts the number of alive units, subtracts the number of dead units, counts the number of loaded units, when the number of alive units is equal to the number of units in a vehicle it sets convoyloaded as 1
Anyway, ill implement your suggestion
EDIT: ok, if you could tell me if i understand your script correctly id be very grateful:
_units_default = _this <this sets all the defined units in the editor init field (man1, man2...etc) as an array called _units_default?>
_units_array = [] <this creates an array called _units_array, and sets its value as null>
"if (alive _x) then {_units_array = _units_array + [_x]}" foreach _units_default <i'm not sure what _x refers to...but if _x is alive then the null array _units_array is set to _x, this line is gathering all the alive units and putting them into _units_array?>
@"vehicle _x == _x" count _units_array == 0 <ok, vehicle _x==_x will determing if a unit is not in a vehicle, so when no units of the _units_array array are in a vehicle this line will be passed, setting convoyloaded to 1... genius =)
convoyloaded = 1
exit