Stuntard

Heli script

Dec 11th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.25 KB | None | 0 0
  1. EVAC_HELI_spawnMarker = "heliBase"; // STRING - marker name of where to start and delete the helicopter.
  2. EVAC_HELI_helicopterType = "B_Heli_Transport_01_F"; // STRING - class name of the helicopter to use.
  3. EVAC_HELI_hovering = false;
  4. EVAC_HELI_feedback = true; // BOOL - Yell smoke out like a boss?
  5.  
  6. if (isNil "EVAC_HELI_Active") then {EVAC_HELI_Active = false;};
  7.  
  8. EVAC_Heli_addEventHandler = {
  9.     args = _this;
  10.     _heli = _this select 1;
  11.     _helicaller = _this select 0;
  12.  
  13.    
  14.     _idx = _helicaller addEventHandler ["Fired", {
  15.         if ((_this select 4) != "SmokeShell") exitWith {};
  16.  
  17.         _null = (_this select 6) spawn {
  18.  
  19.             _posg = getPos _this;
  20.             sleep 0.5;
  21.  
  22.             while {(_posg distance (getPos _this)) > 0} do {
  23.                 _posg = getPos _this;
  24.                 sleep 0.5;
  25.             };
  26.             player sideChat "Smoke seen. Landing now";
  27.         };
  28.     }];
  29. };
  30.  
  31.  
  32. EVAC_Heli_moveTo = {
  33.     if(EVAC_HELI_Active) exitwith {hint "Evac chopper is not available at this time";};
  34.     EVAC_HELI_Active = true;
  35.     _helicaller = _this select 0;
  36.    
  37.     _dist = 50 + random 25;
  38.     _dir = random 360;
  39.     _spawnPos = getMarkerPos EVAC_HELI_spawnMarker;
  40.     _hoverPos = [(getPos _helicaller select 0) + (sin _dir) * _dist, (getPos _helicaller select 1) + (cos _dir) * _dist];
  41.    
  42.     hint format ["Point Marked: %1",_hoverpos];
  43.     sleep 1;
  44.     _tmp = createMarker ["Helimarker",_hoverpos];
  45.     _tmp setMarkerShape "ICON";
  46.     _tmp setMarkerType "hd_dot";
  47.     _tmp setMarkerColor "ColorOpFor";
  48.  
  49.     // Spawn helicopter and crew.
  50.     _helisv = [_spawnPos, [_spawnPos, _hoverpos] call BIS_fnc_dirTo , EVAC_HELI_helicopterType, west] call BIS_fnc_spawnVehicle;
  51.     _heli = _helisv select 0;
  52.     _heliCrew = _helisv select 1;
  53.     _heliGroup = _helisv select 2;
  54.     (driver _heli) allowFleeing 0;
  55.  
  56.     // Waypoint to the location for heli
  57.     _wp1 = _heliGroup addWaypoint [_hoverpos, 0];
  58.     _wp1 setWaypointSpeed "FULL";
  59.     _wp1 setWaypointType "MOVE";
  60.     _wp1 setWaypointStatements ["true", "EVAC_HELI_hovering=true;"];
  61.     _heli flyInHeight 60;
  62.    
  63.     waituntil{EVAC_HELI_hovering};
  64.     _heli sideChat "Evac chopper awaiting confirmation of LZ. Mark it with Green Smoke and we'll bring her down";
  65.     [_helicaller,_heli] spawn EVAC_Heli_addEventHandler;
  66. };
  67.  
  68. _caller = _this select 0;
  69. [_caller] call EVAC_Heli_moveTo;
Add Comment
Please, Sign In to add comment