I try to create a list of all alive enemies within a 300m radius. The closest enemy should be the first one in the array.
There are a few commands I can use like neartargets, but neartargets only returns the enemies the unit knows about, so I use nearestobjects
Works fine but all units are returned, also the dead. The name is different tho, it's something like EAST 1-1-A:9,111fdc00#5168: np soldier_b.p3d.
I try to exclude these targets with a script, but still the dead guys are in my list. What is wrong? Is there a better way to do this?
_list = nearestObjects [player, ["man"], 300]
_i = 0
_c = count _list
#exclude
_m = _list select _i
?!alive _m && side _m == side player: _list = _list - [_m]
_i = _i + 1
~0.5
?_i < _c : goto "exclude"
hint format ["%1", _list]