OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Nivraga on 03 Sep 2012, 07:11:30

Title: Landing Gear Up/Pants on the Ground
Post by: Nivraga on 03 Sep 2012, 07:11:30
I know this has been asked before ... the threads I've found do not provide a suitable answer. I know it can be done because I've done it - but I found the answer here and I lost the test mission in which I had it set up. I keep finding a reference to "Sefe's Landing Gear Tutorial" but I cannot find that either - maybe that's a Addon/Mod tutorial which wouldn't solve my problem.

Basically I want to have a plane on the ground with it's landing gear up - as if it did an emergency belling landing without exploding. I did find 1 solution in my forums search - I could have AI flying the plane long enough to get gear up - then set velocity to 0 - and move the plane to my crash site. However, I know there is a way to script this.

The Action command Plane action ["land gear"] does not work - maybe I'm not putting the Action Command in the right place - I just assumed Init.sqs or unit initialization.

Somebody please help me.
Title: Re: Landing Gear Up/Pants on the Ground
Post by: Lenyoga on 03 Sep 2012, 18:55:14
That's a hard one... well, maybe the idea of having a plane flying already (then using deletevehicle to get rid of the driver, setvelocity 0 and setpos to where it should be) is the best one.
Title: Re: Landing Gear Up/Pants on the Ground
Post by: Nivraga on 03 Sep 2012, 19:32:06
So after thinking on this some more ... I'm pretty sure the answer was a script to run the landing gear up command as if the player was pilot. Anyone know how to write that?

There has to be a way to execute the gear up command with a script without being in the plane as pilot
Title: Re: Landing Gear Up/Pants on the Ground
Post by: savedbygrace on 04 Sep 2012, 07:29:23
The best way to try this is to identify which plane you want to use. open it's pbo, look into its files for what code is used to animate the gear(much like animating a door). For example...
_plane Animate ["Rightgear", 1];
_plane Animate ["Leftgear", 1];
_plane Animate ["nosegear", 1];

Then you'll be looking like a fool with your pants on the ground  :dunno: Had to say it
Title: Re: Landing Gear Up/Pants on the Ground
Post by: Lenyoga on 04 Sep 2012, 09:56:16
Does it work with animate? I haven't seen any definitions of animations in the BIS .cpp for planes...
Title: Re: Landing Gear Up/Pants on the Ground
Post by: savedbygrace on 04 Sep 2012, 23:31:32
I've depboed several plane addons and sought out the gear control scripts. Each addons gear script has that code in them(not in the config). The only difference is the name in which they refer to their gear. I've depboed the Soviet plane but found nothing to use and can't find the A10 files either. Not sure where to get my hands on  those scripts but you could always use an addon where finding things is much more simple.
Title: Re: Landing Gear Up/Pants on the Ground
Post by: Lenyoga on 05 Sep 2012, 12:45:14
That's actually a great idea.
Title: Re: Landing Gear Up/Pants on the Ground
Post by: Nivraga on 06 Sep 2012, 06:43:23
The best way to try this is to identify which plane you want to use. open it's pbo, look into its files for what code is used to animate the gear(much like animating a door). For example...
_plane Animate ["Rightgear", 1];
_plane Animate ["Leftgear", 1];
_plane Animate ["nosegear", 1];

Then you'll be looking like a fool with your pants on the ground  :dunno: Had to say it

Thanks 'sbg' The addon I am using is Rad_F18 Hornet

After I depbo'd the addon I found in the config.cpp that for the action to raise or lower gear it was calling on gearctrl.sqs ... in that I found ...

;Gear Animations
_frontGearAnim="frontgearanim"
_leftGearAnim ="leftgearanim"
_rightGearAnim="rightgearanim"

so using your suggestion I created gear.sqs with simply this ...
crash Animate ["Rightgearanim", 1];
crash Animate ["Leftgearanim", 1];
crash Animate ["frontgearanim", 1];


call that sqs from the planes init and bang - looking like a fool with your pants on the ground.