IMO you're getting a bit carried away there, if you read again what Rellikki wants there is no need for such a complex script lagging your game with nearestObject searches, at least not in this case.
This is just a simple example
init.sqf/sqs
your_alarm_control_variable = false;
MYTAG_bodyArr = [];
What you need is a killed eventhandler for each friendly:
this addEventHandler ["killed",{MYTAG_bodyArr = MYTAG_bodyArr + [this]}]
Then a script running on all the guards (execVM "script.sqf")
private ["_i","_unit"];
_i = 0;
while {alive _this && !(your_alarm_control_variable)}
do {
_unit = MYTAG_bodyArr select _i;
hint format ["%1\n%2",_this knowsAbout _unit,_unit];
if ((_this knowsAbout _unit)>1.5 && (_this distance _unit) <= 20)
exitWith {your_alarm_control_variable = true};
_i = _i + 1;
if (_i > count MYTAG_bodyArr) then {_i = 0};
sleep 2;
};
At least this way I could get the guards to detect a dead friend and raise an alarm.
Execute on group leader or on a single unit.
This starts to suck though the more bodies there are in the body array...
Of course a more complex find dead body script would be usefull..
And I'm guessing within few hours a Mando Detect Body is available