//Checks for casualities in the array of units. Originally worked via an interesting fact of the 'count' command in which count _units would give you the number of units the leader -thinks- are alive, not the actual living amount. This however does not work outside of a group scope, so it is now a much simpler check.;

_array = _this select 0;
_units = _this select 1;

_j = {alive _x} count _units;

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

if (_j > _i) then
	
	{
	private ["_Sounds", "_unit", "_random1", "_random2", "_unit"];	
	_Sounds = (call _Array) select 0;
	_random2 = floor (random (count _Sounds));
	_random1 = floor (random _i);
	_unit = (_units select _random1);
	if (_unit !=Player && vehicle _unit == _unit) then {_unit say (_Sounds select _random2)};
	_j = {alive _x} count (_units);
	};
		
};