Jump to content
Sign in to follow this  
scottb613

Sync two waypoints via script ?

Recommended Posts

Hi Folks,

One more question and I'll slink off to work this on my own for a while... In the editor - when you do an air assault - and you're dropping troops at an LZ - you have to sync the "transport unload" and the "get out" waypoints for the transport helicopter and the troops so they unload properly...

I'm now trying to generate everything dynamically via scripts including all waypoints - do I have to code this sync (if so how ?) - or is it not necessary ?

Thanks...

Regards,

Scott

Sent from my iPad using Tapatalk

Share this post


Link to post
Share on other sites

Here is how i do that mostly:

	private _hspawnPos = BIS_fnc_findSafePos; //use this function with correct syntax to get heli spawn pos
	private _insertionPos = BIS_fnc_findSafePos; //use this function with correct syntax to get insertion pos
	private _reinf_grp = BIS_fnc_spawnGroup; //use this function with correct syntax to spawn group which will be inserted
	private _vehicle = BIS_fnc_spawnVehicle; //use this function with correct syntax to spawn heli vehicle with crew
	
	private _heli = _vehicle select 0; //heli vehicle
	private _heliGroup = _vehicle select 2; //heli crew group

	
	//move units of insertion group into heli
	{
		_x assignAsCargo _heli;
		_x moveInCargo _heli;
			
	} foreach (units _reinf_grp);
		
	//add wp0 to heli crew group
        private _wp = _heliGroup addWaypoint [_insertionPos, 0];
	_wp setWaypointType "MOVE";
	_wp setWaypointBehaviour "CARELESS";
	_wp setWaypointCombatMode "GREEN";
	_wp setWaypointSpeed "FULL";
	_wp setWaypointFormation "COLUMN";
	_wp setWaypointStatements ["true", "(vehicle this) land 'LAND'"];
	
	//spawn invisible helipad at insertion pos to prevent heli pilot landing free chose
	private _heliPad = "Land_HelipadEmpty_F" createVehicle _insertionPos;

	//wait until heli land
	waitUntil {sleep 5; ((getPos _heli) select 2) < 2};
	
	if (alive _heli) then {

			//insertion group lives heli
			_reinf_grp leaveVehicle _heli;
			
			//wait until no insertion units in heli
			waitUntil {sleep 5; ({_x in _heli} count (units _reinf_grp)) isEqualTo 0};
			
			//add return waypoint 1 to heli crew group, after reached vehicle and crew gets removed
		        private _wp1 = _heliGroup addWaypoint [_hspawnPos, 1];
			_wp1 setWaypointType "MOVE";
			_wp1 setWaypointBehaviour "CARELESS";
			_wp1 setWaypointCombatMode "GREEN";
			_wp1 setWaypointSpeed "FULL";
			_wp1 setWaypointFormation "COLUMN";
			_wp1 setWaypointStatements ["true", "deleteVehicle (vehicle this); {deleteVehicle _x} forEach thislist"];
			
	};
	deleteVehicle _helipad;
	//add waypoints or task for _reinf_grp
	
  • Like 1

Share this post


Link to post
Share on other sites

HI D...

Thanks for the response - let me play with this and see if it works for me - much appreciated...

Regards,

Scott

Sent from my iPad using Tapatalk

Share this post


Link to post
Share on other sites

Oh! And if you are doing that in Tanoa, my advice is: forget about BIS_fnc_findSafePos....

 

And yes, what Tajin says, instead of creating waypoints for the heli + waituntil + once the heli landed create waypoints for the infantry, you can create waypoints for both and synchronise them. No need of waituntil.

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  

×