plannedExtraction.sqf – a helo transport solution


So here’s one of many ways of doing this. You can download this demo mission from the intertubes.

Place your Functions Module as well as hStart and hEnd markers where you want the helo to spawn and where you want the player’s group to be dropped off. Place a Radio trigger with:

Code:
nul = [player] execVM "plannedExtraction.sqf";

Then the plannedExtraction.sqf is:

Code:
//////////////////////////////////////////////////////
//  From trigger:
//  nul = [player] execVM "plannedExtraction.sqf";
//
//  Pre-place "hStart" and "hEnd" markers on the map.
/////////////////////////////////////////////////////

// Wait till the Functions module is ready.
waituntil {!isnil "bis_fnc_init"};

// Declare everything.
_unit = _this select 0; // who called it.
_chopperType = "CH_47F_EP1";  // Type of transport.
_start = getMarkerPos "hStart";  // location of start/spawn/delete location.
_end = getMarkerPos "hEnd";  // location of drop off.
_landPos = [_unit, 20, getdir _unit] call BIS_fnc_relPos;  // location of pickup, 20m in front of caller

if (isServer) then {
	// message letting them know it's coming.
	hintSilent "Extraction chopper inbound!";  
	
	// Create a little shiney ball we can use to get the direction from start to caller with
	_blinky = "Sign_sphere10cm_EP1" createVehicle _start;
	_flightPath = [_blinky, _unit] call BIS_fnc_relativeDirTo;		
	
	// Spawn the helo, facing the user, in the air at the start location.
	_ch = [[_start select 0, _start select 1, 50], _flightPath, _chopperType, side _unit] call BIS_fnc_spawnVehicle;
	
	// Name the helo globally so that waypoint orders will work.
	transporthelo = _ch select 0;
	_chGroup = _ch select 2; // group of helo so waypoints work.
	_chGroup setBehaviour "CARELESS"; // Make sure they don't get distracted.
	// transporthelo setCaptive true; // uncomment this to make your ride safe.
	
	// These lines might be needed in MP. :)  Didn't test it yet.
//	_ch select 0 setVehicleInit "transporthelo = this; this setVehicleVarName ""transporthelo""";
//	processInitCommands;
	
	// Delete the cute little light that let us spawn facing the right direction
	// and create landing spots for pickup and dropoff.
	deleteVehicle _blinky;
	_lzPickup = "HeliHEmpty" createvehicle _landPos;
	_lzDropOff = "HeliHEmpty" createvehicle _end;
	
	// Give the helo a waypoint to where the player is and make it land, engines on.
	wp0 = _chGroup addwaypoint [_landPos, 20];
	wp0 setwaypointtype "MOVE";
	wp0 setWaypointStatements ["","transportHelo land ""GET IN"""];
	
	// Wait till the player's group is in the helo.
	waitUntil{{_x in transporthelo} count units group _unit == count units group _unit};
	
	// Once they are, off we go by setting a TRANSPORT UNLOAD waypoint.  
	// It'll auto boot the leader once there, but he'll have to tell the others to get out.
	wp1 = _chGroup addwaypoint [_end, 20];
	wp1 setwaypointtype "TR UNLOAD";
	wp1 setWaypointStatements ["","transportHelo land ""GET OUT"""];
	
	// Wait till the player's group is out of the helo.
	waitUntil{{_x in transporthelo} count units group _unit == 0};
	
	// Once they are out, set a waypoint back to the start and clean up by deleting the helo and landing pads.
	wp2 = _chGroup addwaypoint [_start, 20];
	wp2 setwaypointtype "MOVE";
	wp2 setWaypointStatements ["true","{deleteVehicle _x} forEach crew transporthelo; deletevehicle transporthelo;"];
	deleteVehicle _lzPickup;
	deleteVehicle _lzDropOff;
};
  1. #1 by Katdog5 on September 17, 2010 - 5:46 PM

    great site. cheers — This extraction is working great and i love it. (we don’t run a dedicated server though)

    Have you heard if this works with a dedicated server?

    I know it doesnt without those lines. I added them but havent heard anything from dedicated folks

    ch select 0 setVehicleInit “transporthelo = this; this setVehicleVarName “”transporthelo”””;
    processInitCommands;

  2. #2 by thedog on September 25, 2010 - 7:43 AM

    hey man,

    works like a charm in editor, single player and multiplayer, just not on a dedicated server 🙁 im trying to find out why and what not. would be cool if you could get back to me on steam or email.

    later mate!

    ps. love the site btw

  3. #3 by Paul on November 2, 2010 - 2:28 PM

    Has anyone got this to work on a dedicated server yet

    Thanks

  4. #4 by Signaller on November 27, 2010 - 1:40 PM

    This is one of my fave scripts!

    Does anyone know of a way to make it repeatable every few minutes as opposed to repeatable every click?

    I added these lines to make green smoke on the pick up wp.

    _GreenSmoke = “SmokeShellgreen” createVehicle position _lzPickup;

    _GreenSmoke setPos (getPos _lzPickup);

    The only problem with it is the smoke runs out too quickly, any ideas on how to lengthen its duration?

    Thanks =)

  5. #5 by Dave on November 29, 2010 - 3:13 AM

    Works great…except in hilly terrain where I inevitably die after being picked up, because the chopper crashes into the terrain. 🙂 (or he does durring ingress.)

    Is there anyway to set the “Fly altitude” for an entity that doesn’t exist yet?

    I try to find a clearing for him to land/dust-off from during extraction, but its hard in places like the coast of Chadarus[sic].

  6. #6 by Dave on November 29, 2010 - 3:55 AM

    I fixed it…I think. 🙂

    transporthelo setCaptive true; // I uncommented this to make my ride safe. (I’m not exactly sure what this does…yet) and I added the following line. (I think it works…so far no crashes.) 🙂
    transporthelo flyInHeight 250;

Comments are closed.