Advertisement
Erwin23p

m_transport_1.sqf

Apr 6th, 2017
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQF 1.76 KB | None | 0 0
  1. private ["_h","_group","_groupUnits","_groupLeader","_aliveUnits","_inHelo","_M"];
  2.  
  3. _h = h1;
  4. _group = aa1;
  5. _groupLeader = leader _group;
  6. _groupUnits = count units _group;
  7. _aliveUnits = {alive _x} count units _group;
  8. _inHelo = false;   
  9. finishedmission = 0;
  10.  
  11. pad = "Land_HelipadEmpty_F" createVehicle [3148.06,11624.7,0];
  12.  
  13. _M = [west,["task2"],["We noticied a lot of enemy movement, we need to reforce our positions. Transport this Anti Air team to the designated position.",
  14. "Transport AA team",""],pad,true,3,true] call BIS_fnc_taskCreate;
  15.  
  16. sleep 2;
  17. {_x assignAsCargo _h;_x enableAI "Move";_x setUnitPos "UP";_x setBehaviour "SAFE";_x setSpeedMode "FULL"}
  18. forEach units _group;
  19. _wp = _group addWaypoint [position _h, 0];
  20. _wp setWaypointType "GETIN";
  21.  
  22. while {finishedmission == 0} do
  23. {
  24.     _aliveUnits = {alive _x} count units _group;
  25.     if ({_x in _h} count units _group == _groupUnits AND !_inHelo) then
  26.         {
  27.             _groupLeader sideChat "All in, we are ready to go.";
  28.             _inHelo = true;
  29.         } else
  30.         {   if ({_x in _h} count units _group == 0 AND _inHelo) then
  31.             {
  32.                 _groupLeader sideChat "We are off, you are clear to go.";
  33.                 _inHelo = false;
  34.             };
  35.         };
  36.     if ((player distance pad) < 50 AND (((getPosATL _h) select 2) < 5) AND speed _h < 5) then
  37.     {
  38.         {unassignVehicle _x; _x action['EJECT', vehicle _h]} forEach units _group;
  39.     };
  40.     if (!alive player OR _aliveUnits < _groupUnits) then
  41.     {
  42.         _M = ["task2", "FAILED"] spawn BIS_fnc_taskSetState;
  43.         finishedmission = 1;
  44.     };
  45.     if ((player distance pad) < 30 AND (_aliveUnits == _groupUnits) AND ({_x in _h} count units _group == 0))
  46.     then
  47.         {
  48.             _M = ["task2", "SUCCEEDED"] spawn BIS_fnc_taskSetState;
  49.             finishedmission = 1;
  50.         };
  51.     sleep 1;
  52.     if (finishedmission == 1) then
  53.         {
  54.             deleteVehicle pad;
  55.         };
  56. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement