this should make a condition for when the average of all enemy units in the desired distance reachest a certain point, rather that just the closest one.
first make a repeating trigger detecting enemies to follow the player, then in the init of the trigger make a list e.g. triglist
then in a script, attach the list to a variable array e.g. _list = _this select 0; (0 being the name of the list)
then make a loop that goes something like this:
// call {[triggerlist, minimum distance, maximum distance, time before detected] execVM "thisscript.sqf"}
_list = _this select 0;
_min = _this select 1;
_max = _this select 2;
_detec = _this select 3;
_timer = 0;
while {alive player} do
{
_distArray = _distArray + player distance {_x} foreach _list;
_m = 0 + {_x} foreach _list;
_c = count distArray;
_ans = _m / _c;
if (_ans <_min AND _ans >_max) then
{
_timer = _timer + 1;
} else
{
_timer = 0;
};
if (_timer == _detec) then
{
//guns go blazing, everyone who hates you is shooting at you etc.
exit;
};
sleep 1;
};
btw, i have no idea if this works, i havent tested it.