anden3 icon

Interrogate.sqf

anden3 | PRO | 01/03/17 11:36:23 AM UTC | 0 ⭐ | 339 👁️ | Never ⏰ | []
SQF |

930 B

|

None

|

0 👍

/

0 👎

_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