Jump to content
Sign in to follow this  
Meatball0311

AI does not raise landing gear on takeoff

Recommended Posts

I am working on my F/A-18 project and one of the bugs is the AI doesnt raise the landing gear on takeoff. It flies around with the landing gear down. I have been trying to script telling it something like

_f18 = _this select 0;
_pilot = driver _f18;
_speed = speed _f18;
_initheight = getTerrainHeightASL [position _f18];

if ((_initheight > 100) && ( _speed > 100)) then {
	_f18 animate ["frontgear",1];
	_f18 animate ["rear_ndoor",1];
	_f18 animate ["leftgear",1];
	_f18 animate ["rightgear",1];
	_f18 animate ["rgear_rot",1];
	_f18 animate ["lgear_rot",1];
	_f18 animate ["f_nrdoor",0];
	_f18 animate ["lgdoor",0];
	_f18 animate ["rgdoor",0];
	_f18 animate ["rou_lgdoor",0];
	_f18 animate ["rou_rgdoor",0];
	_f18 animate ["rin_lgdoor",0];
	_f18 animate ["rin_rgdoor",0];
	_f18 animate ["f_ndoor",0];
	_f18 animate ["f_ndoor2",0];
	_f18 animate ["r_ndoor",0];
	[_f18] execVM "\fz_f18\init_fa18f_aw_sqf";
	};


if ((_initheight < 100) && ( _speed > 100)) then {
	_f18 animate ["lgdoor",1];
	_f18 animate ["rgdoor",1];
	_f18 animate ["rou_lgdoor",1];
	_f18 animate ["rou_rgdoor",1];
	_f18 animate ["rin_lgdoor",1];
	_f18 animate ["rin_rgdoor",1];
	_f18 animate ["f_ndoor",1];
	_f18 animate ["f_ndoor2",1];
	_f18 animate ["r_ndoor",1];
	_f18 animate ["f_nrdoor",1];
	_f18 animate ["leftgear",0];
	_f18 animate ["rightgear",0];
	_f18 animate ["rgear_rot",0];
	_f18 animate ["lgear_rot",0];
	_f18 animate ["frontgear",0];
	_f18 animate ["rear_ndoor",0];
	};

};  

I am using my own landing Gear scripts and useractions, can AI use the gears this way?

Share this post


Link to post
Share on other sites

Couple of things I can see.

Do you need that first \ in the execVM? Should it read execVM"fz_f18\blah ?

And secondly shouldnt it end in .sqf instead of _sqf ?

I'm a scripting noob - so forgive me if I'm wrong.

Share this post


Link to post
Share on other sites

Question going back to the root cause;

Is there any reason why you are using scripted landing gear?

Can you not try them via use the normal animation source "gear" ?

Share this post


Link to post
Share on other sites
Couple of things I can see.

Do you need that first \ in the execVM? Should it read execVM"fz_f18\blah ?

And secondly shouldnt it end in .sqf instead of _sqf ?

I'm a scripting noob - so forgive me if I'm wrong.

:butbut:

Thanks for pointing that out.. I will correct that error and try removing a "\".

---------- Post added at 08:47 AM ---------- Previous post was at 08:44 AM ----------

Gnat;2014177']Question going back to the root cause;

Is there any reason why you are using scripted landing gear?

Can you not try them via use the normal animation source "gear" ?

This is a port of Franzes F-18 so it origninally was set up with scripted animation landing gears, I dont know how to revert it back to ArmaA2 useractions. How would I revert it back to normal animation source 'leftgear' 'rightgear' 'frontgear'? I know making 'gearRetracting = true;' makes the useraction appear, but it doesnt work the gears. How would I make the normal animation useraction work the gears on the plane?

Edited by Meatball0311

Share this post


Link to post
Share on other sites
gearRetracting = true;

Yes.

Now go to your MODEL.CFG

Find all the

Class frontgear, Class ear_rot etc etc

Change the source from "user" to "gear"

Looks like some are reversed .....

eg some are animate 1 and some are animate 0

If they are reversed ingame, simply swap the values in MINVALUE and MAXVALUE or swap the angles in ANGLE0 adn ANGLE1

You can "delay" animations by using different numbers like;

minValue=0.90;

maxValue=1.00;

This means the animation doesnt start until 0.9 and finishes at 1.0

You can "shorten" the animation by using different numbers like;

minValue=0.0;

maxValue=0.2;

This means the animation starts at 0.0 but finishes early at 0.2 (not 1.0 )

You can change how long the whole "gear" animations take with;

gearUpTime = 4.5;

gearDownTime = 3;

in the config.cpp

Edited by [APS]Gnat

Share this post


Link to post
Share on other sites

Thanks a lot Gnat you are always eager to help out! I reverted the F/A-18 back to ArmA useraction source gear and it works fine, but the problem with the AI not raising the gear from takeoff is still persisting. I even have this in a init_fa18f_aw.sqs :

#standbyloop

~1

?(player in _f18): goto "mainloop"

_posz = getposASL _f18 select 2

_aipilot = driver _f18

;;?((getpos _f18 select 2) <= 1): _f18 animate ["suspension",1]

;;?((getpos _f18 select 2) > 1): _f18 animate ["suspension",0]

? ((_posz > 50) && (isengineon _f18) && !(player in _f18)): [_f18] execVM "fz_f18\scripts\ai_geardn.sqf"

? ((_posz < 50) && (isengineon _f18) && !(player in _f18)): [_f18] execVM "fz_f18\scripts\ai_gearup.sqf"

;;29 sts_gear

?(_f18 animationphase "leftgear" >= 0.0001): _f18 setobjecttexture [29,"\fz_f18\t\up.paa"]

?(_f18 animationphase "leftgear" <= 0.0001): _f18 setobjecttexture [29,"\fz_f18\t\dn.paa"]

?(_f18 animationphase "canopy" >= 0.5): _f18 lock false

?(_f18 animationphase "canopy" <= 0.5): _f18 lock true

goto "standbyloop"

The ai just seems to be acting weird.. and not like normal BIS AI??

Share this post


Link to post
Share on other sites

Thats not normal, and you shouldn't need to script anything.

In fact, once you go "gear" you can't force gear as such anymore.

Either players operate it, of AI operate it.

You don't have any ROADWAY lods do you? You shouldnt.

Share this post


Link to post
Share on other sites

I do not have any ROADWAY lods. I will try to remove the scripts with anything to do with AI.

Share this post


Link to post
Share on other sites

Just a thought ..... if gear is staying down, then theres a high chance its being damaged.

Test:

- Start an AI F18 in editor "Flying". If gear goes up, AI are good.

- Ask AI to land, check gear comes out.

- Ask same AI to take off again

- If gear stays down after takeoff ... likely damaged

Does the same happen to non-AI?

ie After you takeoff, the GEAR-UP option has disappeared from menu?

Share this post


Link to post
Share on other sites
Gnat;2014957']Just a thought ..... if gear is staying down' date=' then theres a high chance its being damaged.

Test:

- Start an AI F18 in editor "Flying". If gear goes up, AI are good.

- Ask AI to land, check gear comes out.

- Ask same AI to take off again

- If gear stays down after takeoff ... likely damaged

Does the same happen to non-AI?

ie After you takeoff, the GEAR-UP option has disappeared from menu?[/quote']

No I get the Gear Up option when I takeoff and the AI is still acting the same way. I have even stripped the whole addon of its scripts and slowly added each one test them to see if they are confilicting and the AI does not change. Do I have to order the plane or pilot to animate "frontgear"?

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  

×