Jump to content

Recommended Posts

Boerstil, any chance of a sample mission of that, can't get it to work

Edited by ozzyt109
formating

Share this post


Link to post
Share on other sites

AI Taxi and taking off... No landing yet.

 

I haven't messed with this sense idk end of may or June. An update broke most of my scripts so I'm rewriting this. The link above has a sample mission for planes taxiing and taking off. No landings or taxiing for landing in it yet. If I get more spare time I'll see what I can do.

  • Like 2

Share this post


Link to post
Share on other sites

Looks like we are working through the next few weekends. So progress will be slowed down. :/

Share this post


Link to post
Share on other sites

Does anybody know how to make AI pilots level out Flaps, rudders and anything else on the jets so it will take off straight?

Share this post


Link to post
Share on other sites
On 21/05/2017 at 3:51 AM, Aebian said:

        /*
            author: @Aebian
            description: Launch script for AI catapult start from USS Freedom
            returns: nothing
            created: 2017-05-02
            // _null = [Freedom, KI_plane02,"Catapult3"] execVM "scripts\ki_launch.sqf"
        */

        params["_carrier","_plane", "_catapult"];


        private _carrierObj = "Land_Carrier_01_hull_07_F";

        if (_catapult in ["Catapult1", "Catapult2"]) then {
            _carrierObj = "Land_Carrier_01_hull_04_F";
        };

        (driver _plane) disableAI "MOVE";

        sleep 10;

        _carrierObjects = _carrier nearObjects [_carrierObj, 100];

        _CarrierPart = _carrierObjects param [0, objNull];

        _carrierPartCfgCatapult = configfile >> "CfgVehicles" >> _carrierObj >> "Catapults" >> _catapult;
        _CarrierPartanimations = getArray (_carrierPartCfgCatapult >> "animations");
        [_CarrierPart, _CarrierPartanimations, 10] spawn BIS_fnc_Carrier01AnimateDeflectors;

        sleep 14;
        _plane engineOn true;

        [_plane] call BIS_fnc_AircraftCatapultLaunch;

        sleep 4;
        (driver _plane)  enableAI "MOVE";
        sleep 6;
        [_CarrierPart, _CarrierPartanimations, 0] spawn BIS_fnc_Carrier01AnimateDeflectors;

Thats how I've done it. not the best code I know but it works. Script takes three arguments. The Carrier object, the plane to launch and the catapult. I placed my planes in front of the catapult where I wanna launch them in also did some 


disableAI "MOVE";

 

59074d3255896894661499.png

 

Picture from: https://aebian.org/story/arma-3-animate-catapult-blast-deflectors-uss-freedom

It doesn't work anymore since the last update.

Share this post


Link to post
Share on other sites

This is the Launch code I use to Launch the planes.

 

params ["_plane","_dirCatapult","_velocityLaunch","_velocityIncrease","_accelerationStep","_posCatapult"];

_dirCatapult = (_dirCatapult - 0.3);
_plane allowDamage false;
_plane setAirplaneThrottle 1;
_plane setPosWorld _posCatapult;
private _velocity = 0;
private _timeStart = time - 1.75;
private _timeDelta = 0;
_plane setVectorDir (surfaceNormal (getPosASL _plane));
_plane setDir _dirCatapult;
[_plane, 0, 0] call BIS_fnc_setPitchBank;
while
{
	(speed _plane < (_velocityLaunch + 210) && {isEngineOn _plane && {((getPos _plane) param [2,0]) < 7}}) || _plane distance _posCatapult <= 140
}
do
{

	_plane setAirplaneThrottle 1;

	_timeDelta = (time - _timeStart);
	_velocity = _velocityIncrease * _timeDelta;

	_plane setVelocity [sin _dirCatapult * _velocity,cos _dirCatapult * _velocity,(velocity _plane select 2)];

	if (_plane distance _posCatapult < 121 && (istouchingGround _plane)) then {[_plane, 0, 0] call BIS_fnc_setPitchBank} else {[_plane, -2, 0] call BIS_fnc_setPitchBank};
	sleep _accelerationStep;
};

This is Deck control script for Launching:

 

_plane = param [0,objNull,[objNull]];

_hulls = param [1,["Land_Carrier_01_hull_04_1_F","Land_Carrier_01_hull_04_F","Land_Carrier_01_hull_07_1_F","Land_Carrier_01_hull_07_F"],[[]]];
_carrier = param [2,objNull,[objNull]];
_pos = param [3,(getPosWorld _plane),[[]]];
private _dir = getDir _plane;
private _height = _pos select 2;
_car_dir = getdir _carrier;
_plane_dir = _plane getdir _carrier;
//private _hull = selectRandom _hulls;

private _partClass = "";

_partClass = switch (true) do
{
	case ((_plane distance _carrier) < 100 && "Land_Carrier_01_hull_04_1_F" in _hulls): {"Land_Carrier_01_hull_04_1_F"};
	case ((_plane distance _carrier) < 100 && "Land_Carrier_01_hull_04_F" in _hulls): {"Land_Carrier_01_hull_04_F"};
	case ((_plane distance _carrier) > 100 && "Land_Carrier_01_hull_07_1_F" in _hulls): {"Land_Carrier_01_hull_07_1_F"};
	case ((_plane distance _carrier) > 100 && "Land_Carrier_01_hull_07_F" in _hulls): {"Land_Carrier_01_hull_07_F"};
	default { Nil };

};
if (isNil "_partClass") exitWith {hint "No carrier hull parts found"};
_catapult = switch (true) do
{
	case (_partClass isEqualTo "Land_Carrier_01_hull_04_1_F"): {selectRandom ["Catapult1","Catapult1"]};
	case (_partClass isEqualTo "Land_Carrier_01_hull_04_F"): {selectRandom ["Catapult1","Catapult2"]};
	case (_partClass isEqualTo "Land_Carrier_01_hull_07_1_F"): {selectRandom ["Catapult3","Catapult4"]};
	case (_partClass isEqualTo "Land_Carrier_01_hull_07_F"): {selectRandom ["Catapult3","Catapult4"]};
	default { Nil };
};
if (isNil "_catapult") exitWith {hint "No catapults found"};
private _carrierObjects = _carrier nearObjects [_partClass , 200];
private _part = _carrierObjects param [0, objNull];
private _configPath = configfile >> "CfgVehicles" >> _partClass >> "Catapults" >> _catapult;
private _animations = getArray (_configPath >> "animations");
private _memPoint = getText (_configPath >> "memoryPoint");
private _dirOffset = getNumber (_configPath >> "dirOffset");
private _posCatapult = _part modelToWorld (_part selectionPosition _memPoint); _posCatapult set [2, _height];
private _dirCatapult = (getDir _part - _dirOffset - 180) % 360;
private _configPlane = configFile >> "CfgVehicles" >> typeOf _plane;
private _velocityLaunch = getNumber (_configPlane >> "CarrierOpsCompatability" >> "LaunchVelocity") max 210;
private _velocityIncrease = getNumber (_configPlane >> "CarrierOpsCompatability" >> "LaunchVelocityIncrease") max 35;
private _accelerationStep = getNumber (_configPlane >> "CarrierOpsCompatability" >> "LaunchAccelerationStep") max 0.09;
private _launchBar = getText (_configPlane >> "CarrierOpsCompatability" >> "LaunchBarMemoryPoint");

_car_dir = getdir _carrier;
_plane_dir = _plane getdir _carrier;

_dir_setting = if ((((_car_dir - _plane_dir) + 360) mod 360) <180) then {
	[_plane,(_car_dir - 90)] call UssF_fnc_USS_Freedom_AP_turn;
} else {
	[_plane,(_car_dir + 90)] call UssF_fnc_USS_Freedom_AP_turn;
};


[_plane,_part,_configPath,_memPoint,_posCatapult,_carrier] call UssF_fnc_USS_Freedom_GoCat;
[_plane,_dirCatapult] call UssF_fnc_USS_Freedom_AP_turn;
_plane setVariable ["Stayput",true,true];
[_plane,10] spawn UssF_fnc_USS_Freedom_Brakes;
_plane animate ["wing_fold_l", 0];
_plane animate ["wing_fold_r", 0];
sleep 10;
_plane setVariable ["Stayput",false,true];
waitUntil {_plane getVariable "BrakesRon"};

[_plane,_dirCatapult,_velocityLaunch,_velocityIncrease,_accelerationStep,_posCatapult] call UssF_fnc_USS_Freedom_Luanch;

This is for Braking the plane so it doesn't drive off while you are trying to Launch it.

 

params ["_plane","_howlong"];

private _howlong = if (isNil "_howlong") then {86400} else {_howlong};
private _pos = GetPosASL _plane;

(vehicle _plane) forceSpeed 0;
(vehicle _plane) disableAI "MOVE";

_timer = time + _howlong;
_plane setVariable ["BrakesRon",true,true];

private _stay = true;

while { _stay && (time < _timer) } do {

   _plane setPosASL _pos;
   _plane setVelocity [0,0,0];
   doStop _plane;
   _plane stop true;
   _plane forceSpeed 0;
   _plane disableAI "MOVE";
   sleep .001;
   _stay = if (!(_plane getVariable "Stayput") || (player in _plane)) then {false} else {true};

};
_plane setVariable ["BrakesRon",false,true];
_plane setVariable ["Stayput",false,true];

(vehicle _plane) forceSpeed -1;
(vehicle _plane) enableAI "MOVE";

This is for Turning the plane on deck to taxi to launching spot:

params ["_plane","_dir"];
if (_dir < 0) then
{
	_dir = _dir + 360;
}
else
{
	if (_dir >= 360) then {_dir = _dir - 360;};
};

private _turning = true;
while {_turning} do {
	private _planeDir = (round _dir - round (getDir _plane));
	if (_planeDir < 0) then
	{
		_planeDir = _planeDir + 360;
	}
	else
	{
		if (_planeDir >= 360) then {_planeDir = _planeDir - 360;};
	};
	if (speed _plane > 0) then {_plane setVelocity [0,0,0]};
	private _dirAdj = if (_planeDir < 180) then {1} else {-1};
	private _speedturn = if (_planeDir >= 5) then {3} else {1};
	private _dirSet = ((getDir _plane) + (_dirAdj * _speedturn));

	if (_dirSet < 0) then
	{
	  _dirSet = _dirSet + 360;
	}
	else
	{
	  if (_dirSet >= 360) then {_dirSet = _dirSet - 360;};
	};
	_plane setDir _dirSet;
	_turning = if (ceil (getDir _plane) == ceil _dir || floor (getDir _plane) == floor _dir) then {false} else {true};
	sleep .001;

};

This script sends the plane to Launch position:

 

params ["_plane","_CarrierPart","_CarrierPartCfgCatapult","_mCfgCatapultMemPnt","_Catapult_pos","_carrier"];

(vehicle _plane) forceSpeed 0;
(vehicle _plane) disableAI "ALL";
_pos = (ATLtoASL (_plane getPos [24,getDir _plane]));
_reldirC = _plane getDir _pos;
[_plane,_reldirC] call UssF_fnc_USS_Freedom_AP_turn;
[_plane,_pos,_CarrierPart,_reldirC] call UssF_fnc_USS_Freedom_GoPark;


_reldir = _plane getDir _Catapult_pos;
[_plane,_reldir] call UssF_fnc_USS_Freedom_AP_turn;

[_plane,_CarrierPart,_mCfgCatapultMemPnt,_reldir] call UssF_fnc_USS_Freedom_Go_attach_Cat;

waitUntil {_plane distance2D _Catapult_pos < 3};
_plane setPosWorld _Catapult_pos;
(vehicle _plane) forceSpeed -1;
(vehicle _plane) enableAI "ALL";

_CarrierPartanimations = getArray (_CarrierPartCfgCatapult >> "animations");
[_CarrierPart, _CarrierPartanimations, 10] spawn BIS_fnc_Carrier01AnimateDeflectors;
[_plane,_Catapult_pos,_CarrierPart,_CarrierPartanimations] spawn {
  params ["_plane","_Catapult_pos","_CarrierPart","_CarrierPartanimations"];
  waitUntil {!(isTouchingGround _plane)};

  [_CarrierPart, _CarrierPartanimations, 0] spawn BIS_fnc_Carrier01AnimateDeflectors;
};

This is the init that gets it started:

 

if !(isServer) exitWith {hint"notServer"};

UssF_fnc_USS_Freedom_Brakes = compile preprocessFileLineNumbers "CarCom\fn_USS_Freedom_Brakes.sqf";
publicVariable "UssF_fnc_USS_Freedom_Brakes";

UssF_fnc_USS_Freedom_AP_turn = compile preprocessFileLineNumbers "CarCom\fn_USS_Freedom_AP_turn.sqf";
publicVariable "UssF_fnc_USS_Freedom_AP_turn";
UssF_fnc_USS_Freedom_Go_attach_Cat = compile preprocessFileLineNumbers "CarCom\fn_USS_Freedom_Go_attach_Cat.sqf";
publicVariable "UssF_fnc_USS_Freedom_Go_attach_Cat";
UssF_fnc_USS_Freedom_GoCat = compile preprocessFileLineNumbers "CarCom\fn_USS_Freedom_GoCat.sqf";
publicVariable "UssF_fnc_USS_Freedom_GoCat";
UssF_fnc_USS_Freedom_Luanch = compile preprocessFileLineNumbers "CarCom\fn_USS_Freedom_Luanch.sqf";
publicVariable "UssF_fnc_USS_Freedom_Luanch";

UssF_fnc_USS_Freedom_Luanch_Prep = compile preprocessFileLineNumbers "CarCom\fn_USS_Freedom_Luanch_Prep.sqf";
publicVariable "UssF_fnc_USS_Freedom_Luanch_Prep";
UssF_fnc_USS_Freedom_GoPark = compile preprocessFileLineNumbers "CarCom\fn_USS_Freedom_GoPark.sqf";
publicVariable "UssF_fnc_USS_Freedom_GoPark";
UssF_fnc_USS_Freedom_Deck_control = compile preprocessFileLineNumbers "CarCom\fn_USSFreedom_Deckcontrol.sqf";
publicVariable "UssF_fnc_USS_Freedom_Deck_control";

hint "please wait";


waitUntil {time > 1};

_allAirports = allAirports;
_airport = ((_allAirports select 1) select 0);
_planes = nearestObjects [carrier1, ["Plane"], 500];
_hulls = nearestObjects [carrier1, ["Land_Carrier_01_hull_04_1_F","Land_Carrier_01_hull_04_F","Land_Carrier_01_hull_07_1_F","Land_Carrier_01_hull_07_F"], 500];
_hullsTypes = [];
{
	_hullsTypes pushBack (typeOf _x);
} forEach _hulls;
_planesFront = [];
_frontParking = [];
_planesBack = [];
_backParking = [];

{
	private _plane = _x;
	_plane animate ["wing_fold_l", 1];
	_plane animate ["wing_fold_r", 1];
	if ((_plane distance carrier1) < 100) then {
		_planesFront pushBack _plane;
		_frontParking pushBack (getPosWorld _plane);
	} else {
		_planesBack pushBack _plane;
		_backParking pushBack (getPosWorld _plane);
	};


} forEach _planes;
sleep 4;
[_planesFront,_hullsTypes,carrier1,_airport] spawn {
	params ["_planesFront","_hullsTypes","_carrier","_airport"];
	{
		_plane = vehicle _x;
		if ({alive _x}count (crew _plane) == 0) then {createVehicleCrew _x};
		_plane engineOn false;

		_plane setVariable ["Stayput",true,true];
		[_plane,4] spawn UssF_fnc_USS_Freedom_Brakes;
		sleep 4;
		[_plane,_hullsTypes,_carrier] call UssF_fnc_USS_Freedom_Deck_control;
		sleep 11 + (round (random 21));
		_plane assignToAirport _airport;

	} forEach _planesFront;
};

sleep 3 + random 4;
[_planesBack,_hullsTypes,carrier1,_airport] spawn {
	params ["_planesBack","_hullsTypes","_carrier","_airport"];
	{
		_plane = vehicle _x;
		if ({alive _x}count (crew _plane) == 0) then {createVehicleCrew _x};
		_plane engineOn false;

		_plane setVariable ["Stayput",true,true];
		[_plane,4] spawn UssF_fnc_USS_Freedom_Brakes;
		sleep 4;
		[_plane,_hullsTypes,_carrier] call UssF_fnc_USS_Freedom_Deck_control;
		sleep 14 + (round (random 18));
		_plane assignToAirport _airport;

	} forEach _planesBack;
};
sleep 240;
{
	player setPosWorld _x;
	sleep 14;
} forEach (_frontParking + _backParking);

This is the mission I use for the scripts:

Testing AI Launching and taxiing

 

Still haven't worked on Landing and taxiing to parking spots, but smoothed up the Taxiing and Launching a good bit. It also Launches 2 planes at staggered time intervals. 

 

Feel free to use, edit, and share how you want. My only stipulation is. If you find a better way, or something that will help other learn. SHARE your findings here. So that others may be able to learn and help the community. Some of the scripts above are edited from BIS original scripts.

  • Like 2

Share this post


Link to post
Share on other sites

sorry to be a muppet but....

what script do i use if i just want to launch 1 aircraft off the CV to then follow waypoints?

For dedicated (but works in editor of course) nothing fancy, just shoots the thing off the boat

 

the CarCom one that @mikey74 posted up works great for launching the plane but i don't want the taxi stuff first, aircraft just needs to lock in and launch off

 

any of those functions i can comment out??

Share this post


Link to post
Share on other sites

is their possibility of creating a addon with the scripts like a modules you link it to fighter in top of uss freedom and it takeoff

Share this post


Link to post
Share on other sites
On ‎9‎/‎24‎/‎2017 at 9:22 PM, PSYKO_nz said:

sorry to be a muppet but....

what script do i use if i just want to launch 1 aircraft off the CV to then follow waypoints?

For dedicated (but works in editor of course) nothing fancy, just shoots the thing off the boat

 

the CarCom one that @mikey74 posted up works great for launching the plane but i don't want the taxi stuff first, aircraft just needs to lock in and launch off

 

any of those functions i can comment out??

You can use stock Bis Scripts for that. ;) If you go into function in the editor the select Jets in one of the categories. Bis has some farely decent scripts. 

 

On ‎9‎/‎24‎/‎2017 at 10:09 PM, Mootaz23 said:

is their possibility of creating a addon with the scripts like a modules you link it to fighter in top of uss freedom and it takeoff

Yes. I've been considering it. Pretty sure as soon as I post it someone else will post one that's better. ;) lol

 

If I get time and nothing pops up I may work on script packs and maybe modules. Been very busy in my life so all my mods have been neglected or plain abandoned.

Share this post


Link to post
Share on other sites
On 25-9-2017 at 4:09 AM, Mootaz23 said:

is their possibility of creating a addon with the scripts like a modules you link it to fighter in top of uss freedom and it takeoff

 

The thing especially with arma 3 editor is is that it is all about smoke and mirrors.

It doesn't matter which of the options you take from above everything works perfectly after you've flushed out the unintended bugs.

It is easy to write a script if you know what you need, writing a script for someone else can be tricky therefor.

Just look around to what we've all been saying and for sure one of them will work for you to.

  • Like 1

Share this post


Link to post
Share on other sites

Lets say that scripts are easier to maintain then a module. Thanks for the script sharing ^^

Share this post


Link to post
Share on other sites

Sorry for kicking this thread.
 

I still can´t lift up the deflectors... (needed for dedicated server!)
I don´t play the developers-version of Arma3.
lotse4 is the deck-marshall (today on duty for catapult4), which should play some nice animations from the cutscenes in animations-viewer, but thats the second problem described at the end of this thread.

This is my code:
(executed via trigger:   0 = [freedom, KI_plane04,"Catapult4"] execVM "scripts\ki_launch4.sqf";   carriername is "freedom", jetfighter is called "KI_plane04"  )

params["_carrier","_plane", "_catapult"];


        private _carrierObj = "Land_Carrier_01_hull_07_F";

        if (_catapult in ["Catapult3", "Catapult4"]) then {
            _carrierObj = "Land_Carrier_01_hull_07_F";
        };
		[lotse4, "Acts_JetsMarshallingEnginesOn_in"] remoteExec ["switchMove", 0];
		sleep 2.366;
       	(driver _plane) disableAI "MOVE";
		[lotse4, "Acts_JetsMarshallingEnginesOn_loop"] remoteExec ["switchMove", 0];
	    sleep 10;
		[lotse4, "Acts_JetsMarshallingEnginesOn_out"] remoteExec ["switchMove", 0];
		sleep 0.066;
		[lotse4, "Acts_JetsCrewaidFCrouch_in_m"] remoteExec ["switchMove", 0];
		sleep 2.866;
        [lotse4, "Acts_JetsCrewaidFCrouch_loop_m"] remoteExec ["switchMove", 0];
        _carrierObjects = _carrier nearObjects [_carrierObj, 100];
        _CarrierPart = _carrierObjects param [0, objNull];
        _carrierPartCfgCatapult = configfile >> "CfgVehicles" >> _carrierObj >> "Catapults" >> _catapult;
        _CarrierPartanimations = getArray (_carrierPartCfgCatapult >> "animations");
        [_CarrierPart, _CarrierPartanimations, 10] spawn BIS_fnc_Carrier01AnimateDeflectors;
        sleep 14;
		[lotse4, "Acts_JetsCrewaidLCrouchThumbup_in_m"] remoteExec ["switchMove", 0];
		sleep 1.533;
		[lotse4, "Acts_JetsCrewaidLCrouchThumbup_loop_m"] remoteExec ["switchMove", 0];
		sleep 4.366;
		_plane engineOn true;
        [_plane] call BIS_fnc_AircraftCatapultLaunch;
		[lotse4, "Acts_JetsCrewaidLCrouchThumbup_out_m"] remoteExec ["switchMove", 0];
		sleep 4;
		(driver _plane) enableAI "MOVE";
        sleep 6;
        [_CarrierPart, _CarrierPartanimations, 0] spawn BIS_fnc_Carrier01AnimateDeflectors;

 

 

And another issue:

The loop-animations inserted in the code above will not play as a loop, just the animation time itself or it cuts to early, and it does not repeat.
I want to have the _in, then the _loop (repeated a few times) and than the _out animations played continuesly, the _loop should be played 4x or 2x, then continue to the following animation.
Especially the CrouchThumbUp-stuff, because the marshall should stay down while the jet ist started by the catapult:

_in
_loop (_loop, _loop,...)
jetstart  *wuuusch*
_loop (should end after jet is gone, not before or while start)

_out

I´ve tried around, but it does not really work... I´m really not good at this stuff, please help me with that code... Thanks!

Share this post


Link to post
Share on other sites

How do I use BIS_fnc_AircraftCatapultLaunch? When I put the AI plane on the catapult, ready to launch, and call this function, it either gives an error or doesn't do anything. I used the example from the script's comments:
[_fighter01] call BIS_fnc_AircraftCatapultLaunch

This doesn't appear to do anything. What's the correct way of doing it?

Share this post


Link to post
Share on other sites
On ‎8‎/‎9‎/‎2017 at 9:11 AM, Boerstil said:

I'll share my ai taxi/takeoff script

 


/*
	Author: Boerstil

	Description:
	- Function for aircraft to taxi to catapult then takeoff.

	Exucution:
	- Call the function via code/script

		[_plane,["Catapult1","Catapult2","Catapult3","Catapult4"],_carrier] call BIS_fnc_AircraftCatapultLaunch;

	Parameter(s):
		0: plane/object
		1: array of possible catapults
		2: carrier/object
		3: posWorld of plane (optional)


	Returns: nothing


*/

bor_fnc_CarrierTakeOff =
{

scopeName "takeOff";

_veh = param [0,objNull,[objNull]];
_catapults = param [1,["Catapult1","Catapult2"],[[]]];
_carrier = param [2,objNull,[objNull]];
_pos = param [3,(getPosWorld _veh),[[]]];
private _dir = getDir _veh;
private _height = _pos select 2;
private _catapult = selectRandom _catapults;


private _partClass = "";

if ((_catapult == "Catapult1") || (_catapult == "Catapult2")) then 
{
   _partClass = "Land_Carrier_01_hull_04_F";
} else
{
	_partClass = "Land_Carrier_01_hull_07_F";
};

private _carrierObjects = _carrier nearObjects [_partClass , 200];
private _part = _carrierObjects param [0, objNull];
private _configPath = configfile >> "CfgVehicles" >> _partClass >> "Catapults" >> _catapult;
private _animations = getArray (_configPath >> "animations");
private _memPoint = getText (_configPath >> "memoryPoint");
private _dirOffset = getNumber (_configPath >> "dirOffset");
private _posCatapult = _part modelToWorld (_part selectionPosition _memPoint); _posCatapult set [2, _height];
private _dirCatapult = (getDir _part - _dirOffset - 180) % 360;
private _configPlane = configFile >> "CfgVehicles" >> typeOf _veh;
private _velocityLaunch = getNumber (_configPlane >> "CarrierOpsCompatability" >> "LaunchVelocity") max 210;
private _velocityIncrease = getNumber (_configPlane >> "CarrierOpsCompatability" >> "LaunchVelocityIncrease") max 75;
private _accelerationStep = getNumber (_configPlane >> "CarrierOpsCompatability" >> "LaunchAccelerationStep") max 0.025;
private _launchBar = getText (_configPlane >> "CarrierOpsCompatability" >> "LaunchBarMemoryPoint");

if (true) then 
{
	waitUntil 
	{
		if (!alive (driver _veh)) exitWith {breakto "takeOff";true};
		!(_carrier getVariable ["landing",false]) && (_part animationPhase (_animations select 0) < 2)
	};
	_veh setFuel 1;
	_veh engineOn True;
	_veh setPosWorld _pos;	
	sleep 5;
	
	waitUntil
	{
		if (!alive (driver _veh)) exitWith {breakto "takeOff";true};	
		isEngineOn _veh
	};

	while {(_veh distance _pos) < 15} do
	{
		_veh setAirplaneThrottle 0.3;
		_veh setDir _dir;
		_veh setVelocity [(sin _dir  * (25 / 3.6)),(cos _dir  * (25 / 3.6)),(velocity _veh select 2)];
		if ((_veh distance _posCatapult) < 15) exitWith {_veh setVelocity [0,0,0];};
		if (!alive (driver _veh)) exitWith {breakto "takeOff"};	
		sleep 0.02
	};
	
	while {!((getDir _veh) > ((_veh getDir _posCatapult) - 3) && (getDir _veh) < ((_veh getDir _posCatapult) + 3))} do
	{ 
		_veh setAirplaneThrottle 0.3;	
		if (!alive (driver _veh)) exitWith {breakto "takeOff"};
		if ((getDir _veh) < (_veh getDir _posCatapult)) then {_veh setDir ((getDir _veh) + 0.5);_veh setVelocityModelSpace [0, (25 / 3.6), 0];} else {_veh setDir ((getDir _veh) - 0.5);_veh setVelocityModelSpace [0, (25 / 3.6), 0];};
		sleep 0.025
	};

	_veh setVelocity [0,0,0];
	private _memoryPos = getPosWorld _veh;
	_veh setVariable ["memoryPos",_memoryPos];
	_veh setVariable ["memoryDir",_dir];
	_veh animate ["wing_fold_l", 0];
	_veh animate ["wing_fold_r", 0];
	_veh animate ["wing_fold_cover_l", 0];
	_veh animate ["wing_fold_cover_r", 0];

	while {(_veh distance _posCatapult) >= 1} do
	{
		waitUntil {(_part animationPhase (_animations select 0) < 1)};
		_veh setAirplaneThrottle 0.3;
		_veh setDir (_veh getDir _posCatapult);
		_veh setVelocity [(sin (_veh getdir _posCatapult) * (25 / 3.6)),(cos (_veh getdir _posCatapult) * (25 / 3.6)),(velocity _veh select 2)];
		if (!alive (driver _veh)) exitWith {breakto "takeOff"};
		sleep 0.025
	};	
	_veh setPosWorld _posCatapult;
	_veh setDir _dirCatapult;
	_veh setBehaviour "AWARE";
	_jetPark =  
	[ 
		(str _veh) + "_parked", "onEachFrame",  
		{ 
			(_this select 0) setAirplaneThrottle 0.3;
			(_this select 0) setVelocity [0, 0, 0]; 
			(_this select 0) setPosWorld (_this select 1);
			(_this select 0) setDir (_this select 2); 		
		},[_veh,_posCatapult,_dirCatapult] 
	] call BIS_fnc_addStackedEventHandler; 

	[_part, _animations, 10] spawn BIS_fnc_Carrier01AnimateDeflectors;

	sleep 10;

	[format ["%1",_jetPark], "onEachFrame"] call BIS_fnc_removeStackedEventHandler; 
	_jetPark2 =
	[ 
		(str _veh) + "_parked", "onEachFrame",  
		{ 
			(_this select 0) setAirplaneThrottle 1;
			(_this select 0) setVelocity [0, 0, 0]; 
			(_this select 0) setPosWorld (_this select 1);
			(_this select 0) setDir (_this select 2); 		
		},[_veh,_posCatapult,_dirCatapult] 
	] call BIS_fnc_addStackedEventHandler; 

	sleep 5;

	[format ["%1",_jetPark2], "onEachFrame"] call BIS_fnc_removeStackedEventHandler; 
	
	
	_veh allowDamage false;
	_veh setAirplaneThrottle 1; 
	_veh setPosWorld _posCatapult;	
	_veh setDir _dirCatapult;
	private _velocity = 0;
	private _timeStart = time;
	private _timeDelta = 0;

	while
	{
		speed _veh < _velocityLaunch && {isEngineOn _veh && {((getPos _veh) param [2,0]) < 1}}
	}
	do
	{
		if (!alive (driver _veh)) exitWith {breakto "takeOff"};
		_veh setDir _dirCatapult;
		_veh setAirplaneThrottle 1;
	

		_timeDelta = time - _timeStart;
		_velocity = _velocityIncrease * _timeDelta;

		_veh setVelocity [sin _dirCatapult * _velocity,cos _dirCatapult * _velocity,velocity _veh select 2];

		sleep _accelerationStep;
	};
	

	[_part, _animations, 10] spawn BIS_fnc_Carrier01AnimateDeflectors;

	private _t = time + 1;

	waitUntil
	{
		if (!alive (driver _veh)) exitWith {breakto "takeOff";true};
		_velocity = velocity _veh;
		_velocity set [2,2];

		_veh setVelocity _velocity;

		time > _t
	};

	[_part, _animations, 0] spawn
	{
		sleep 6;
		_this spawn BIS_fnc_Carrier01AnimateDeflectors;
	};

	sleep 5;
	
	_veh allowDamage True;
	_veh setFuel ((_veh getVariable ["savedFuel",1]) - (1 - (fuel _veh)));
	driver _veh action ["LandGearUp", driver _veh];

};
}

 

Sorry for being totally ignorant, but how do I get this to work?

Share this post


Link to post
Share on other sites

Hey Guys,

I'm a total noob when it comes to scripts and stuff, so I hope you can help me out. I'm looking for a simple way to just manually animate the Jet blast deflectors on the USS Freedom. No Plane launch or anything needed, just the deflectors.

Thank you! 

Share this post


Link to post
Share on other sites
On 24.4.2018 at 4:32 PM, Jan99942 said:

a simple way to just manually animate the Jet blast deflectors on the USS Freedom. No Plane launch or anything needed, just the deflectors.

Do the following:

  1. Name your carrier MyCarrier
  2. Execute the following script
  3. Change the following lines to your needs:
    1. _animationState = 10; // 0 means folded, 10 means nearly 90° to the deck
    2. *partFromAbove* // change this to either _frontLeft, _frontRight, _backLeft, _backRight
_frontLeft = ["Land_Carrier_01_hull_04_1_F","Catapult1"];
_frontRight = ["Land_Carrier_01_hull_04_2_F","Catapult1"];
_backLeft = ["Land_Carrier_01_hull_07_1_F","Catapult4"];
_backRight = ["Land_Carrier_01_hull_07_1_F","Catapult3"];

_animationState = 10;

*partFromAbove* params ["_partClass","_catapult"];
params ["_carrier"];
_carrierPart = (MyCarrier nearObjects [_partClass,200]) select 0;
[
	_carrierPart,
	getArray (configfile >> "CfgVehicles" >> typeOf _carrierPart >> "Catapults" >> _catapult >> "animations"),
	_animationState
] spawn BIS_fnc_Carrier01AnimateDeflectors;

 

  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites

Hi there

 

I'm a totally noob in scripting and I tried this script a thousand times. It didn't work for me. I also have found a video tutorial in french (I didn't understand much :down:) but it also didn't work.

 

So please, can anybody upload a mission where one plane start from catapult 3 and after this a plane start from catapult 4 (like in the showcase mission). It would be great if there is also the catapult crew with their special animations (like in the showcase mission).

 

Thanks a lot!!! 

Share this post


Link to post
Share on other sites

The whole launch process is a rather complicated subject and not newbie friendly. If you still want to see how BIS did it you'll have to get a pbo viewer, a text editor and an fsm editor (found in the A3 Tools on Steam). The path to BI's mission is this one:

<ArmA 3 main folder on Steam>\Jets\Addons\missions_f_jets.pbo\showcases\showcase_jets.altis

 

Here is the mission for the editor:

https://drive.google.com/open?id=1LJpJ4hPIQcbZ7dB-WazQ7Pi0IHozOFjy

 

The most interesting part is the following section from missionFlow.fsm:

//start the wingman launch procedure
[] 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" >> "Catapult3";
	_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 12;

	[BIS_crewAidL_2,"playmovenow","Acts_JetsCrewaidLCrouch_loop",_mirroredAnims] call bis_fnc_carrier01CrewPlayAnim;
	sleep 0.5;
	[BIS_crewAidR_2,"playmovenow","Acts_JetsCrewaidRCrouch_loop",_mirroredAnims] call bis_fnc_carrier01CrewPlayAnim;
	sleep 0.5;
	[BIS_crewAidF_2,"playmovenow","Acts_JetsCrewaidF_runB",_mirroredAnims] call bis_fnc_carrier01CrewPlayAnim;

	[BIS_shooter_2,"playmove","Acts_JetsShooterIdle",_mirroredAnims] call bis_fnc_carrier01CrewPlayAnim;
	[BIS_shooter_2,"playmovenow","Acts_JetsShooterIdleMoveaway_loop",_mirroredAnims] call bis_fnc_carrier01CrewPlayAnim;
	sleep 4.7;
	[BIS_shooter_2,"playmove","Acts_JetsShooterIdleMoveaway_out",_mirroredAnims] call bis_fnc_carrier01CrewPlayAnim;


	[BIS_wingman,[BIS_shooter_2,BIS_crewAidF_2,BIS_crewAidL_2,BIS_crewAidR_2],_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 200;

	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;

	BIS_shooter_2 playmove "Acts_JetsShooterIdle2";
	BIS_crewAidF_2 playmove "Acts_JetsCrewaidF_idle";
	BIS_crewAidL_2 playmove "Acts_JetsCrewaidL_idle";
	BIS_crewAidR_2 playmove "Acts_JetsCrewaidR_idle";
};

 

You might wanna start there if you feel up to the task. I won't be able to provide any script since I am busy atm.

  • Like 1

Share this post


Link to post
Share on other sites

Thank you for your help. After dozens of hours it works. Also with the specific animations. Do you have any idea how the ai could land on the carrier?

Share this post


Link to post
Share on other sites
On 4/9/2018 at 4:22 AM, Kalle Arsch said:

Thank you for your help. After dozens of hours it works. Also with the specific animations. Do you have any idea how the ai could land on the carrier?

I have followed THIS example..and it work. Have the plane taxing after landing is another story then. I also try the takeoff script posted above with success, but cannot get the deck crew animation working. Would you mind share how you got it working.

Thank you. 

  • Like 1

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

×