_UnitSay = {
params ["_unit", "_text", ["_duration", 2]];
_unit setRandomLip true;
_unit globalChat _text;
sleep _duration;
_unit setRandomLip false;
};
params ["_ai", "_player", "_action"];
_ai removeAction _action;
_aiPos = getPos _ai;
_playerPos = getPos _player;
_relHeading = ((((_playerPos select 0) - (_aiPos select 0)) atan2 ((_playerPos select 1) - (_aiPos select 1))) + 360) % 360;
[_ai, _relHeading] spawn {
params ["_ai", "_target"];
_currentDir = getDir _ai;
_turnDir = 1;
if (_target - _currentDir >= 180) then {
_turnDir = -1;
_currentDir = _currentDir + 360;
};
for "_heading" from _currentDir to _target step (10 * _turnDir) do {
_ai setFormDir _heading;
_ai setDir _heading;
sleep 0.01;
};
};
[_player, "Hello!"] call _UnitSay;
[_ai, "Fuck off."] call _UnitSay;
[_player, "k bai"] call _UnitSay;
Comments