Count AI left in an area?

fshow

New Member
Hi.

How do i count AI left alive in a specific area?
I'm using WAI if that matters...
What im looking for is this (Yea, i know its wrong, just explaining the logic;) );
if (( player is near position x ) AND ( ai_alive near position y > 0 )) then { lets party };

Anyone?
 
Code:
_radius     =  2500;
_cords     =  [10443.7,2199.12,0]; // elektro

_list = _cords nearEntities [["SurvivorW2_DZ","Survivor2_DZ","Sniper1_DZ","Soldier1_DZ","Camo1_DZ","BanditW1_DZ","Bandit1_DZ","Survivor3_DZ"], _radius];

_players = {isPlayer _x} count _list;
_ai = {!isPlayer _x} count _list;
_all = (count _list);

hint format["Players: %1 AI: %2 all: %3",_players,_ai,_all];

With 'players in vehicle' detection
Code:
_radius     =  2500;
_cords     =  [10443.7,2199.12,0];
_playersInVehicle = 0;

_list = _cords nearEntities [["SurvivorW2_DZ","Survivor2_DZ","Sniper1_DZ","Soldier1_DZ","Camo1_DZ","BanditW1_DZ","Bandit1_DZ","Survivor3_DZ"], _radius];
_listV = _cords nearEntities [["LandVehicle"], _radius];
{if (!isPlayer _x) then {_listV = _listV - [_x]}} foreach _listV;

_players = {isPlayer _x} count _list;

_playersInVehicle = {_playersInVehicle + (count (crew _x))} foreach _listV;
if (isNil "_playersInVehicle") then {_playersInVehicle = 0};

_ai = {!isPlayer _x} count _list;
_all = (count _list) + _playersInVehicle;

hint format["Players: %1 Players in vehicles: %2 AI: %3 all: %4",_players,_playersInVehicle,_ai,_all];

I think you find it useful ;)
 
Back
Top