Jump to content

Recommended Posts

Is there a way to make AI takeoff from the USS Freedom like in the showcase? I'm sure there is, since it's in the showcase... I just can't find the right commands. I've looked through the new commands added with 1.70, but there seems to be nothing of the sort added. If you place AI on the carrier with a waypoint it just stands there or it rides off the carrier.

Share this post


Link to post
Share on other sites

I've been trying to figure this out as well, with no luck so far, but I wanted to share what I've found in the hopes that we can all figure this out as I think it could be really cool.  If you look through the functions accessible in the Extended Debug Window, you can see the functions that I think they used to put together the showcase mission.  Here's a list of the ones that I think are relevant:

  • BIS_fnc_AircraftCatapultLaunch
  • BIS_fnc_AircraftSystemsInit
  • BIS_fnc_AircraftTailhook
  • BIS_fnc_AircraftWingStateCheck
  • BIS_fnc_Carrier01AnimateDeflectors
  • BIS_fnc_Carrier01CatapultActionAdd
  • BIS_fnc_Carrier01CatapultActionRemove
  • BIS_fnc_Carrier01CatapultID
  • BIS_fnc_Carrier01CatapultLockTo
  • BIS_fnc_Carrier01CrewInAnim
  • BIS_fnc_Carrier01CrewPlayAnim

I've been experimenting with them to get them to work but haven't been able to figure it out yet.  The only one that I can get to work is BIS_fnc_Carrier01CatapultID.  If you're sitting in the cockpit on the flight deck with the engine running, run "hint str (["true",100] call bis_fnc_carrier01CatapultID);" and it will return the catapult ID closest to you (0 is the bow right catapult, 1 is the bow left cat, 2 is the waist right cat, and 3 is the waist left cat). 

 

It looks like BIS_fnc_Carrier01CatapultLockTo will only work on the players aircraft and I think that's the function they use at the beginning of the showcase to move your plane to the catapult.  I've dug through the config files to find the inputs required for it and can get it to run with no errors, but it doesn't do anything.  To prevent others from having to dig through the config files of the carrier, the catapults can be found in the config viewer under configfile >> "CfgVehicles" >> "Land_Carrier_01_hull_04_F" (for the bow cats) and Land_Carrier_01_hull_07_F (for the waist cats).

 

I've tried placing an AI aircraft on a catapult and calling BIS_fnc_AircraftCatapultLaunch on it (I think this is what they used for the AI plane in the showcase) but all I get is a generic error in expression from inside the function, so I'm figuring there's some setup you need to do before you call it.  I'm going to try looking through the function line by line to see what it's actually doing, but I'm not all that experienced with ARMA scripting.

 

I'm going to keep plugging away at this as I like a challenge, but I'm working this weekend so I don;'t know how far I'll get any time soon.  Does anyone else have some thoughts on this?

  • Like 1

Share this post


Link to post
Share on other sites

Or someone opens the mission Bohemia has created and figures out how they have done this...

Because in the showcase fighter jets you buddy the AI takes off right before you do.

I'm also looking how, and got no time to spit out the folders to find the showcase mission file.

But just saying, it is possible...

  • Like 1

Share this post


Link to post
Share on other sites

Never mind, normally you can just go into the pbo file and extract that.

But for some reason are only the latest DLC in ebo format...

its the encrypted pbo format from VBS.

Share this post


Link to post
Share on other sites
        /*
            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

  • Like 2

Share this post


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

 

Nice one, didn't try it out yet but unitCapture & unitPlay might work tho as-long you make it SP and it is designed to be run only 1 at a time...

Only problem you would get with this (I assume) it will look like he takes off from the catapult but doesn't in reality because the script just runns the record all over again.

 

 

https://community.bistudio.com/wiki/BIS_fnc_UnitCapture

https://community.bistudio.com/wiki/BIS_fnc_UnitPlay

Edited by theo1143
vid

Share this post


Link to post
Share on other sites

With that script, I assume I write "this execVM "script.sqf""; in a trigger and disableAI "MOVE"; in the init of the jet? After take off will it follow waypoints as normal?

Share this post


Link to post
Share on other sites

Normally yes, since the AI flag for moving gets re-enabled at the end of the script:

(driver _plane)  enableAI "MOVE";

All other AI behaviour remain untouched, waypoints should work after the script has completed.

 

EDIT: Thanks for the props, theo :3

Edited by Mokka
Saying Thank You
  • Like 1

Share this post


Link to post
Share on other sites

Can anyone tell me why the jet still move even if  I put disableai "move" on the unit init ?
Thank you

Share this post


Link to post
Share on other sites

I am not quite sure what you mean with the above, as your post is not very descriptive in regards to your problem.

Where does the jet move? On the ship before taking off, or after taking off?

Share this post


Link to post
Share on other sites

Sorry  if I understand correctly I have to use a disableai command on the unit init to use the script of aebian. This happened before take-off so when I use the disableai "move" the ai plane still move on the deck so I'm unable to use the script 

sorry if didn't make myself clear

 

Share this post


Link to post
Share on other sites

@manofwar82 This exact Problem persist also on my side. But in the Jets DLC Showcase BI also just use the disableAI "move" command and there it works =/

I guess I need to dig a little further how BIS AI behaved. FSM search ftw...

 

2017-05-24_01-39-25.png

Share this post


Link to post
Share on other sites

 

On 2017-5-24 at 7:40 AM, Aebian said:

...

 

(driver _plane)  enableAI "MOVE";
enables the _soldier1 disableAI "MOVE"; 

It seems you are disabling the move on the plane, not on the driver that is the first thing that goes wrong.

Secondly it seems that disabling anything (path or move) on the vehicles has no effect whatsoever.

 

 

Put ... on the pilot only.

this disableAI "MOVE";

 

And make sure the _plane changes into the plane name, in your case: ... in the script.

(driver BIS_Wingman) enableAI "MOVE";

 

Now what soldier2390 says is correct, I've experienced that myself tho.

Changing "MOVE" into "PATH" fixes it.

Share this post


Link to post
Share on other sites

Thank you very much for the help I think I figured it out as Theo said I was putting "disableai" command  on the plane not on the pilot now everything  works, very nice script
Another thing I would like to ask is there a way to make a unit perform a series of animations without call always the command playmove or switchmove?
Thank you

Share this post


Link to post
Share on other sites
59 minutes ago, manofwar82 said:

Thank you very much for the help I think I figured it out as Theo said I was putting "disableai" command  on the plane not on the pilot now everything  works, very nice script
Another thing I would like to ask is there a way to make a unit perform a series of animations without call always the command playmove or switchmove?
Thank you

 

No worries.

 

Yes and no, https://steamcommunity.com/sharedfiles/filedetails/?id=623475643 is a mod that add's another line which does what you want.

Once installed just double click on any soldier and you will find a animation tab in there.

It is hard to say since things change quit often in arma but animation are only supposed to work on SP missions.

(the mod uses these commands: https://community.bistudio.com/wiki/BIS_fnc_ambientAnim )

 

Also what you can do, which I like more myself is just launch any mission from the editor and go to animations from the ESC menu.

You find a tab about under MOVE that says CUTSCENE there are all the useful animations.

Whenever you click on a animation you will see it run but also see the time it takes to finish...

So knowing this you can put timers on triggers and let them trigger after each other, little trial and error and you got animations like Bohemia has in their missions.

P.S. Hitting ctrl + c will copy the animations you are looking at.

Share this post


Link to post
Share on other sites
On 5/25/2017 at 3:02 PM, theo1143 said:

 

 


(driver _plane)  enableAI "MOVE";
enables the _soldier1 disableAI "MOVE"; 

It seems you are disabling the move on the plane, not on the driver that is the first thing that goes wrong.

Secondly it seems that disabling anything (path or move) on the vehicles has no effect whatsoever.

 

 

Put ... on the pilot only.

this disableAI "MOVE";

 

And make sure the _plane changes into the plane name, in your case: ... in the script.

(driver BIS_Wingman) enableAI "MOVE";

 

Now what soldier2390 says is correct, I've experienced that myself tho.

Changing "MOVE" into "PATH" fixes it.

Uhm well in my script I did 

(driver _plane) disableAI "MOVE";

So I already applied it to the pilot not the plane! But I will change it to PATH, thanks for that.

Share this post


Link to post
Share on other sites

Disabling AI didn't seem to work. Had to write my own stopplane script to make them do what you see in this video. I'm sharing.

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks @Aebian, your script paired with BIS_fnc_unitPlay seems like the definitive solution (the sleep seems better left at 10 instead of 14 for me).

 

3 hours ago, mikey74 said:

Disabling AI didn't seem to work. Had to write my own stopplane script to make them do what you see in this video. I'm sharing.

 

 

 

Disabling AI works for me and if it didn't, then you could just place an invisible cone in front of the plane.

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, theend3r said:

Thanks @Aebian, your script paired with BIS_fnc_unitPlay seems like the definitive solution (the sleep seems better left at 10 instead of 14 for me).

 

Disabling AI works for me and if it didn't, then you could just place an invisible cone in front of the plane.

Thanks. Didn't think of using a cone. Nice one! I'd bet there is much easier ways to get them to land and park than I have written too. lol

Share this post


Link to post
Share on other sites

Hi there ! Does anybody figured it out how the showcase deals with AI then ? I'm sure there is a way more subtle.

Share this post


Link to post
Share on other sites
On 2017-6-5 at 4:02 PM, Sweedn said:

Hi there ! Does anybody figured it out how the showcase deals with AI then ? I'm sure there is a way more subtle.

 

It is all about smoke and mirrors

Share this post


Link to post
Share on other sites

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];

};
}

 

  • Thanks 1

Share this post


Link to post
Share on other sites
On 5/19/2017 at 1:08 PM, Theo1143 said:

Or someone opens the mission Bohemia has created and figures out how they have done this...

Because in the showcase fighter jets you buddy the AI takes off right before you do.

I'm also looking how, and got no time to spit out the folders to find the showcase mission file.

But just saying, it is possible...

 

This was giving to me when I asked a simular  question. 

 

You can't edit the Apex Protocol missions yet as BI have not decrypted the archives from .ebo to .pboformat yet. Give it a few more months or so and they should be decrypted (IIRC it was about 2-3 months after Marksmen DLC got released before you could depbo the Marksmen showcase pbo, for example.

 

As for vanilla A3, the mission files are no longer stored in missions_f.pbo; it was changed to missions_f_epa.pbo and missions_f_epa_data.pbowhen they refactored The East Wind as an all-in-one campaign as opposed to having separate episodes. All of the other pbos only contain data for the 

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

×