Yeah "nearTargets" will return all units in the given range/position friendly and enemy.
So you would need to do something like:
Code:
private ["_unit","_targets","_count","_selectTarget"];
if (isNil "EnemyArray") then
{
EnemyArray = [];
};
_unit = MyUnit;
_targets = _unit nearTargets 200;
if (count EnemyArray > 0) then
{
_targets = _targets - EnemyArray;
};
if (count _targets > 0) then
{
_count = 0;
while { (_count < count _targets) } do
{
_selectTarget = (_targets select _count);
if ( (_unit knowsAbout _selectTarget > 0) && (_unit countEnemy [_selectTarget] > 0) ) then
{
EnemyArray = EnemyArray + [_selectTarget];
};
_count = _count + 1;
};
};