summaryrefslogtreecommitdiffstats
path: root/Common/Functions/Common_GetHostilesInArea.sqf
blob: eef26472da578e592701e2e6c0a798bc82dbcb8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Private ['_hostiles','_object','_objects','_safeFromSide','_within'];
_object = _this select 0;
_safeFromSide = _this select 1;
_within = if (count _this > 2) then {_this select 2} else {50};

_objects = _object nearEntities[[eastSoldierBaseClass,westSoldierBaseClass,resistanceSoldierBaseClass,"Car","Motorcycle","Tank","Air"],_within];
_hostiles = 0;

if (typeName _safeFromSide == 'ARRAY') then {
	{
		_hostiles = _hostiles + (_x countSide _objects);
	} forEach _safeFromSide;
};
if (typeName _safeFromSide == 'SIDE') then {
	_hostiles = _hostiles + (_safeFromSide countSide _objects);
};

_hostiles