Jump to content
Sign in to follow this  
schadler17

Detecting all enemy units (even unknown) around player

Recommended Posts

Trying to block a Squad Rally/MHQ from being deployed if units are nearby. Right now, I'm using findNearestEnemy which works, but only enemies KNOWN to your player/group.

 

I'm looking for something more efficient, that detects ALL enemies, even ones not known to the player. I've looked around on google and through forums, but everyone uses the findNearestEnemy script.

Share this post


Link to post
Share on other sites

How about nearEntities?

_searchRadius = 100;
_playerPos = getPos player;
_friendlySide = side player;
_neutralSide = CIVILIAN;
_enemyArray = _playerPos nearEntities [["CAManBase"], _searchRadius];

{
	if ((side _x == _friendlySide) || (side _x == _neutralSide)) then {
		_enemyArray = _enemyArray - [_x];
	};
} count _enemyArray;

if ((count _enemyArray) > 0) exitWith {hint "Enemy to close to deploy";};

deploy Squad Rally/MHQ code here... 
  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×