Jump to content
Sign in to follow this  
The Real Bunc

USS Freedom Carrier landings

Recommended Posts

Im trying to crack USS Freedom aircraft carrier AI landings. I've sort of cracked AI takeoffs ( occasional crashes) but Im having problems with AI landings, or more specifically what happens after the AI aircraft lands.

 

I place the carrier and a black wasp and I give the plane a couple of move waypoints. In a waypoint near or on the carrier I put the following code in the waypoint activation

 

plane1 landat ((allAirports select 1) select 0);

 

this works fine and the plane goes round and lands. ( note naming the carrier and using     plane1 Landat carriername   doesn't work despite what the wiki says).

My problem is this - if the waypoint with this code is to the rear of the carrier ( ie at the landing end) then after landing the plan turns round and drives back down the runway and off the ship!

If I put the waypoint in the middle of the ship the plane doesn't do this. It still lands but then it turns round and faces the waypoint and just sits right across the runaway doing nothing else.

Im presuming im going to have to script in detail the planes movement on the ship to get it either off the runway or lined up for a take off. This is a bit of a nuisance because I was looking to have cycled waypoints with the plane landing then lining up and taking off again. Anyone have experience with AI landing and take off from the USS Freedom who could offer advice on this?

  • Like 1

Share this post


Link to post
Share on other sites

I know..they say: "Give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime"...BUT...geez, aren't we all here to help each other?😋😋😋

 

 

well..I'm WIP on a mission where the carrier is a big part of it. If you're doing the same, you'll soon find out the many limits and compromise you'll have to put out in order to use this asset. Anyway..

The first step is to look at THIS, Then, I manage to get the plane to land with this:

_dynamicAirport1 = "DynamicAirport_01_F" createVehicle position this; /// I put this in the init box of the carrier, but you can use a game logic or even a helipad...BUT then you have to smooth out the position to get the jet to land with a minimum degree of reliability.

Follow by this:

YourPlaneName landAt _dynamicAirport1; ///this will make your AI YourPlaneName land at the carrier.

Once they land, the do indeed turn and stop, but with a trigger that calls for a "setPos", I move them wherever I need to. 

 

For AI takeoff, I use this script extracted (and butchered) from the showcase JetDLC mission:

///takeoff.sqf


null = [] execVM "Scripts\catapult_2.sqf";///this is a script I put together to get the deck crew animate for the catapult(could not get the BI_vanilla                                                  script to work, so I came up with this as a placeholder...)

[] spawn
{     
	_mirroredAnims	= false;

	//animate blast deflector
	_carrierObjects = BIS_plane_wingman nearObjects ["Land_Carrier_01_hull_07_1_F", 100];
	_carrierPart = _carrierObjects param [0, objNull];
	_carrierPartCfgCatapult = configfile >> "CfgVehicles" >> "Land_Carrier_01_hull_07_1_F" >> "Catapults" >> "Catapult4";
	_carrierPartanimations = getArray (_carrierPartCfgCatapult >> "animations");
	_dirOffset = getNumber(_carrierPartCfgCatapult >> "dirOffset");
	_direction = (getDir _carrierPart - _dirOffset - 180) % 360;
	
	BIS_plane_wingman setDir _direction;

	sleep 3;
	[_carrierPart, _carrierPartanimations, 10] spawn BIS_fnc_Carrier01AnimateDeflectors;

	private _duration = getNumber(missionConfigFile >> "CfgCarrier" >> "LaunchSettings" >> "duration") max 6;
	private _stepLength = _duration/24;

	sleep 1;
     
	 BIS_Plane_Wingman animate ["wing_fold_r", 0];BIS_Plane_Wingman animate ["wing_fold_l", 0];
	 sleep 5;
	 BIS_Plane_Wingman setFuel 1;
	 sleep 5;



	//[BIS_wingman,_mirroredAnims] execFSM 'playLaunchAnims.fsm';

	private _posWorld = getPosWorld BIS_plane_wingman;

	BIS_wingman enableAI "MOVE";
	BIS_plane_wingman flyInHeightASL [200, 200, 200];
	BIS_plane_wingman forceSpeed 250;

	private _timeStart = time;
	private _timeLaunch = _timeStart + (24 * _stepLength);

	waitUntil
	{
		BIS_wingman setVariable ["carrierCatapultState",floor((time - _timeStart)/_stepLength)];
		BIS_plane_wingman setPosWorld _posWorld;
		BIS_plane_wingman setDir _direction;

		time >= _timeLaunch 
	};

	BIS_wingman setVariable ["carrierCatapultState",25];

	[BIS_plane_wingman,_direction] spawn BIS_fnc_AircraftCatapultLaunch;

	sleep 5;

	//ANIMATE BLAST DEFLECTOR DOWN #3
	[_carrierPart, _carrierPartanimations, 0] spawn BIS_fnc_Carrier01AnimateDeflectors;

	sleep 10;

};

I hope this helps.

  • Like 1

Share this post


Link to post
Share on other sites

Ah I see, I had assumed that the carrier when placed in the editor was automatically a dynamic airport but I see what the distinction is now - your actually creating a dynamic airport at the carrier position. Interestingly my code does exactly the same thing and the land at works without actually creating the dynamicairport_01_F   I assume that although my method worked that it may not be as robust as the method whereby you create an actual dynamic airport. Many thanks for that.    My take offs are working not bad but occasionally planes are crashing on takeoff so Ill have a look at your code and see what I'm missing , again I suspect it might be that although my much simpler code works its maybe not robust enough.   As I suspected it looks like Im going to need to trigger/code the movement between landing and postioning for take off.   Many thanks Zagor.

  • Like 1

Share this post


Link to post
Share on other sites
3 minutes ago, The Real Bunc said:

so Ill have a look at your code and see what I'm missing , again I suspect it might be that although my much simpler code works its maybe not robust enough.

Most of that code is for, is to get the plane, which is position near the catapult to hook up, unfold wings, start the engine and take off. (I'll put together a video to show you asap))

  • Like 2

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  

×