Advertisement
Guest User

Untitled

a guest
Jun 5th, 2022
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. =========================================================
  2. */
  3.  
  4. if (!isServer) exitWith {};
  5.  
  6. // Define variables
  7. _unit = _this select 0;
  8. _delay = if (count _this > 1) then {_this select 1} else {30};
  9. _deserted = if (count _this > 2) then {_this select 2} else {120};
  10. _respawns = if (count _this > 3) then {_this select 3} else {0};
  11. _explode = if (count _this > 4) then {_this select 4} else {false};
  12. _dynamic = if (count _this > 5) then {_this select 5} else {false};
  13. _unitinit = if (count _this > 6) then {_this select 6} else {};
  14. _haveinit = if (count _this > 6) then {true} else {false};
  15.  
  16. _hasname = false;
  17. _unitname = vehicleVarName _unit;
  18. if (isNil _unitname) then {_hasname = false;} else {_hasname = true;};
  19. _noend = true;
  20. _run = true;
  21. _rounds = 0;
  22.  
  23. if (_delay < 0) then {_delay = 0};
  24. if (_deserted < 0) then {_deserted = 0};
  25. if (_respawns <= 0) then {_respawns= 0; _noend = true;};
  26. if (_respawns > 0) then {_noend = false};
  27.  
  28. _dir = getDir _unit;
  29. _position = getPosASL _unit;
  30. _type = typeOf _unit;
  31. _dead = false;
  32. _nodelay = false;
  33. _crew = crew _unit;
  34.  
  35. // Start monitoring the vehicle
  36. while {_run} do
  37. {
  38. sleep (2 + random 10);
  39. if ((getDammage _unit > 0.8) and ({alive _x} count crew _unit == 0)) then {_dead = true};
  40.  
  41. // Check if the vehicle is deserted.
  42. if (_deserted > 0) then
  43. {
  44. if ((getPosASL _unit distance _position > 10) and ({alive _x} count crew _unit == 0) and (getDammage _unit < 0.8)) then
  45. {
  46. _timeout = time + _deserted;
  47. sleep 0.1;
  48. waitUntil {_timeout < time or !alive _unit or {alive _x} count crew _unit > 0};
  49. if ({alive _x} count crew _unit > 0) then {_dead = false};
  50. if ({alive _x} count crew _unit == 0) then {_dead = true; _nodelay =true};
  51. if !(alive _unit) then {_dead = true; _nodelay = false};
  52. };
  53. };
  54.  
  55. // Respawn vehicle
  56. if (_dead) then
  57. {
  58. if (_nodelay) then {sleep 0.1; _nodelay = false;} else {sleep _delay;};
  59. if (_dynamic) then {_position = getPosASL _unit; _dir = getDir _unit;};
  60. sleep 0.1;
  61.  
  62. deleteVehicle _unit;
  63. sleep 2;
  64. _unit = _type createVehicle _position;
  65. _unit setPosASL _position;
  66. _unit setDir _dir;
  67.  
  68. if (_haveinit) then {[[netID _unit, _unitinit], "fnc_setVehicleInit", true, true] spawn BIS_fnc_MP;};
  69.  
  70. if (_hasname) then {[[netID _unit, _unitname], "fnc_setVehicleVarName", true, true] spawn BIS_fnc_MP;};
  71.  
  72. _dead = false;
  73.  
  74. // Check respawn amount
  75. if !(_noend) then {_rounds = _rounds + 1};
  76. if ((_rounds == _respawns) and !(_noend)) then {_run = false;};
  77. sleep 1;
  78.  
  79. _unitsgrp = creategroup east;
  80.  
  81. { typeof _x createUnit [getpos _unit, _unitsgrp];} foreach _crew;
  82. //helicoptertransport synchronizeObjectsAdd [_unitsGroup];
  83. _unitsGroup = units _unitsgrp;
  84. //_unitsgroup = synchronizeObjectsAdd [helicoptertransport];
  85.  
  86. for [{ _loop = 0 },{ _loop < count _unitsGroup},{ _loop = _loop + 1}] do
  87. {
  88. _guy = _unitsGroup select _loop;
  89. //_guy setSkill (_AI_skillArray select _loop);
  90. if (_loop == 0) then {_guy moveInDriver _unit};
  91. if (_loop == 0) then {_guy synchronizeObjectsAdd [helicoptertransport]};
  92. if (_loop == 1) then {_guy moveInTurret [_unit,[0]]};
  93. //if (_loop == 1) then {_guy moveinturret _vcl_new};
  94.  
  95. sleep 0.1;
  96. };
  97.  
  98. };
  99.  
  100. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement