//Checks for enemies killed by creating an array of each unit's ratings, and then comparing them to their current ratings - rating is added whenever the units kill anything. This means the sounds are also triggered when rating is added by for instance the addRating command, however that command is very rarely applied to other than the Player (who never says anything). There is a separate sound for 'large' kill, currently calculated as a kill that gives an excess of 1000 rating points in a single cycle.;

_Array = _this select 0;
_units = _this select 1;

while {{alive _x} count _units > 0 && RUG_DSAI_TerminalDistance != -1} do 
{

_j=0;
_i={alive _x} count _units;
_RatingsArray = [];


	while {_j < _i} do 
	{
	_curSelected = _units select _j;
	_curRating = rating _curSelected;
	_RatingsArray = _RatingsArray + [[_curSelected, _curRating]];
	_j = _j + 1;
	sleep 0.1;
	};

_o= count _RatingsArray;
_k=0;

	while {_o >= {alive _x} count _units} do
	{
	private ["_curUnit", "_rating"];
	_curUnit = (_RatingsArray select _k) select 0;
	_rating = (_RatingsArray select _k) select 1;
	if ((rating _curUnit) > _rating) exitWith 
		{
		private ["_Sounds", "_unit", "_random1", "_random2"];
		_unit = _curUnit;
		if (rating _unit >= (_rating + 1000)) then 
		{_Sounds = (call _Array) select 1} else 
		{_Sounds = (call _Array) select 0};
		_random2 = floor (random (count _Sounds));
		if (_unit !=Player && vehicle _unit == _unit) then {_unit say (_Sounds select _random2)};
		//hint format ["%1 just killed someone!", _unit];
		};

	if (_k < _o) then {_k=_k+1} else {_k = 0;};
	if (RUG_DSAI_TerminalDistance == -1) exitWith {};	
	sleep 0.5;
	};
sleep 1;
};