//Similar to the behaviour check, this simply adds 'generic' sounds such as coughs and sneezes (borrowed from ECP) to the units dependant on their current behaviour. They will not sneeze or cough or anything else if they've spotted enemy units.;

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

_j = 0;

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

{
_i = {alive _x} count _units;
_curUnit = _units select _j;


	if ((behaviour (leader _curUnit) == "SAFE") && isNull ((leader _curUnit) findNearestEnemy (leader _curUnit))) 		then 
	{
	private ["_Sounds", "_random2", "_unit"];
	_Sounds = (call _Array) select 0;
	_random2 = floor (random (count _Sounds));
	_unit = _curUnit;
	if (_unit !=Player && vehicle _unit == _unit) then {_unit say (_Sounds select _random2)};
	sleep (random (RUG_DSAI_CycleTime * 4));
	};
	if ((behaviour (leader _curUnit) == "AWARE") && isNull ((leader _curUnit) findNearestEnemy (leader _curUnit))) 	then
	{
	private ["_Sounds", "_random2", "_unit"];
	_Sounds = (call _Array) select 1;
	_random2 = floor (random (count _Sounds));
	_unit = _curUnit;
	if (_unit !=Player && vehicle _unit == _unit) then {_unit say (_Sounds select _random2)};
	sleep (random (RUG_DSAI_CycleTime * 4));
	};
	if ((behaviour (leader _curUnit) == "COMBAT") && isNull ((leader _curUnit) findNearestEnemy (leader _curUnit))) 	then
	{
	private ["_Sounds", "_random2", "_unit"];
	_Sounds = (call _Array) select 2;
	_random2 = floor (random (count _Sounds));
	_unit = _curUnit;
	if (_unit !=Player && vehicle _unit == _unit) then {_unit say (_Sounds select _random2)};
	sleep (random (RUG_DSAI_CycleTime * 4));
	};
	if ((behaviour (leader _curUnit) == "STEALTH") && isNull ((leader _curUnit) findNearestEnemy (leader _curUnit))) then
	{
	private ["_Sounds", "_random2", "_unit"];
	_Sounds = (call _Array) select 3;
	_random2 = floor (random (count _Sounds));
	_unit = _curUnit;
	if (_unit !=Player && vehicle _unit == _unit) then {_unit say (_Sounds select _random2)};
	sleep (random (RUG_DSAI_CycleTime * 4));
	};

if (_j < _i) then {_j = _j + 1} else {_j = 0};
sleep (RUG_DSAI_CycleTime + 0.1);
};

