Jump to content
Sign in to follow this  
combataz

Looping a helicopter loading units then transport unloading

Recommended Posts

Hey all. I'm working on a mission where me and the boys are defending a town as civilians get evacuated via an AI controlled helicopter. I'm trying to have this helicopter fly the civilians to a location, transport unload them, before coming back, landing, and having another group of units get in.

 nrEEWxe.png

 

So, the extraction helicopter starts a little ways out from the AO, before coming to the evacuation point, where it will land, and load one of the civilian groups. It takes off, goes to the transport unload zone, before going to a move waypoint before cycling down to the land waypoint again. However, it ignores that land/get in waypoint and just flies back to the transport unload waypoint. What am I doing wrong? I'm sure it has something to do with synchronizing the units to the load waypoint, but I'm not sure what exactly that is, beyond them not carrying over through that cycle. What am I missing that doesn't involve a hundred waypoints going back and forth?

Share this post


Link to post
Share on other sites

Isnt' the best and more efficient way to invite to the scenario virtual pilot(s) that could fly the helo for you guys?  Unless, its all about SP scenario.

Share this post


Link to post
Share on other sites
9 minutes ago, NightIntruder said:

Isnt' the best and more efficient way to invite to the scenario virtual pilot(s) that could fly the helo for you guys?  Unless, its all about SP scenario.

 

Apologies! This is an AI controlled helicopter. All players are shooters on the ground. The idea is this is all happening in the background as I watch my friends die horrible deaths, alone in a field in Malden.

Share this post


Link to post
Share on other sites

Can be quite a headache to do with waypoints alone, here's a little snippet that might do the trick:

_nul = [] spawn {

	_dropOff = getMarkerPos "Chopper_DropOff";
	_pickUp = getMarkerPos "Chopper_Evac";
	_chopper = chopper;
	_passengerSlots = count (fullCrew [_chopper,"cargo",true]);
	_civs = allUnits select {_x getVariable ["TAG_fnc_chopperEvac",false]};
	_transportedCivs = 0;

	hintSilent format ["Starting Evac\n%1 civilians\n%2 -> %3\n%4meters\n%5: %6 passenger slots\n%7 trips",count _civs,_pickUp,_dropOff,_pickUp distance2D _dropOff,typeOf _chopper,_passengerSlots,ceil (count _civs / _passengerSlots)];

	while {alive _chopper AND _transportedCivs < count _civs} do {

		_civsToBoard = _civs select [0,_passengerSlots];
		_civs = _civs - _civsToBoard;
		systemchat "Moving to pickup location";
		_chopper move _pickUp;
		waitUntil {unitReady driver _chopper};

		systemchat "Landing";
		_chopper land "GET IN";
		waitUntil {unitReady driver _chopper AND (getPosATLVisual _chopper #2< 1)};

		systemchat format ["Boarding %1",_civsToBoard];
		{_x assignAsCargo _chopper} forEach _civsToBoard;
		_civsToBoard allowGetIn true;
		_civsToBoard orderGetIn true;
		waitUntil {count (_civsToBoard arrayIntersect crew _chopper) isEqualTo count _civsToBoard};

		_chopper land "NONE";
		_chopper move _dropOff;
		systemchat "Moving to dropoff";
		waitUntil {unitReady driver _chopper};

		systemchat "Dropping off";
		_chopper land "GET OUT";
		waitUntil {unitReady driver _chopper AND (getPosATLVisual _chopper #2< 1)};

		_civsToBoard allowGetIn false;
		_civsToBoard orderGetIn false;
		systemchat "Unloading";
		waitUntil {count (_civsToBoard arrayIntersect crew _chopper) isEqualTo 0};

		{unassignVehicle _x} forEach _civsToBoard;
		_civsToBoard = [];
		sleep 3;
	};
};

To get started you can mark civilians for evac by putting this into the init field of each civilian:

this setVariable ["TAG_fnc_chopperEvac",true];

You can select multiple units, then right click one of them to edit all of their init fields at once, less hassle.

 

Then you place two markers, as named in the snippet above.

To guarantee the chopper landing at the marker also place an invisible helipad.

 

The chopper will fly between pickup and dropoff markers and transport all marked civilians, after the job is done the chopper will remain at the dropoff location.

Should get you started, you can easily delete civs at the dropOff location, or delete the chopper if it's no longer needed, add a gunship escort, what have you.

 

Note that this is a barebones version, the chopper might react differently when under fire, same goes for the civilians. This snippet also doesn't take into account if one of the civilians dies.

 

Cheers

  • Like 3

Share this post


Link to post
Share on other sites
On 2/28/2020 at 12:21 PM, combataz said:

 

Apologies! This is an AI controlled helicopter. All players are shooters on the ground. The idea is this is all happening in the background as I watch my friends die horrible deaths, alone in a field in Malden.

 

This video may be helpful to you. 

 

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×