Advertisement
anden3

Interrogate.sqf

Jan 3rd, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 0.93 KB | None | 0 0
  1. _UnitSay = {
  2.     params ["_unit", "_text", ["_duration", 2]];
  3.  
  4.     _unit setRandomLip true;
  5.     _unit globalChat _text;
  6.     sleep _duration;
  7.     _unit setRandomLip false;
  8. };
  9.  
  10. params ["_ai", "_player", "_action"];
  11. _ai removeAction _action;
  12.  
  13. _aiPos = getPos _ai;
  14. _playerPos = getPos _player;
  15.  
  16. _relHeading = ((((_playerPos select 0) - (_aiPos select 0)) atan2 ((_playerPos select 1) - (_aiPos select 1))) + 360) % 360;
  17.  
  18. [_ai, _relHeading] spawn {
  19.     params ["_ai", "_target"];
  20.  
  21.     _currentDir = getDir _ai;
  22.     _turnDir = 1;
  23.  
  24.     if (_target - _currentDir >= 180) then {
  25.         _turnDir = -1;
  26.         _currentDir = _currentDir + 360;
  27.     };
  28.  
  29.     for "_heading" from _currentDir to _target step (10 * _turnDir) do {
  30.         _ai setFormDir _heading;
  31.         _ai setDir _heading;
  32.  
  33.         sleep 0.01;
  34.     };
  35. };
  36.    
  37. [_player, "Hello!"] call _UnitSay;
  38. [_ai, "Fuck off."] call _UnitSay;
  39. [_player, "k bai"] call _UnitSay;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement