Jump to content
Sign in to follow this  
kahna

Open/Close Helicopter Doors

Recommended Posts

Remotely Open and Close Ghosthawk Doors

By: kylania and Kahna

NOTE: If you use vehicle respawns, this has only been tested with Tophe's Simple Vehicle Respawn Script with KRONZKY and BearBison's edits. When referencing vehicle.sqf - it's the vehicle respawn script.

Ghosthawk INIT (Without Respawn):

nul = [this] execVM "ghostDoorsReset.sqf";

Ghosthawk INIT (With SIMPLE VEHICLE RESPAWN SCRIPT):

nul = [this] execVM "ghostDoorsReset.sqf"; 
veh = [this, 60, 300, 0, FALSE, FALSE, "nul = [this] execVM ""ghostDoorsReset.sqf"";"] execVM "vehicle.sqf";

* Loads the addActions to the Ghosthawk initially and reapplies them upon execution of the vehicle respawn script.

ghostDoorsReset.sqf

_heli = _this select 0;

_heli addAction ["<t color='#FE2E2E'>REMOTE: Open Doors</t>", "ghostDoors.sqf",1,1,false,true,"","(_target 

animationPhase 'Door_R' == 0) && (_target animationPhase 'Door_L' == 0)"]; 

_heli addAction ["<t color='#40FF00'>REMOTE: Close Doors</t>", "ghostDoors.sqf",0,1,false,true,"","(_target 

animationPhase 'Door_R' == 1) && (_target animationPhase 'Door_L' == 1)"];

sleep 1;

* Adds the addActions to the Ghosthawk and calls upon ghostDoors.sqf to open/close the doors.

ghostDoors.sqf

hintSilent "Doors Cycling";
_ghost = _this select 0;
_state = _this select 3;
_ghost animateDoor ['door_R', _state];
_ghost animateDoor ['door_L', _state];
sleep 1.75;
hintSilent "Cycle Complete";
sleep 3;
hintSilent "";

Edit and clean up the code to your liking, but this should get amateur scripters and mission makers like myself off on the right foot.

KNOWN BUG: If someone uses the Arma 3 Open (door) action on your Ghosthawk, you will not be able to remotely close your doors until the Arma 3 Close (door) action is activated at which time it will reset your remote commands back to REMOTE: Open. Hopefully someone knows a good fix, but until then just remotely open your doors when landing to pickup/drop off troops.

Edited by Kahna

Share this post


Link to post
Share on other sites

init field of UH80:

this animateDoor ['door_R', 1]; 
this animateDoor ['door_L', 1];

Edited by kylania
Fixed, post was wrong.
  • Like 1

Share this post


Link to post
Share on other sites

EDIT: All good, thanks!

Edited by Kahna

Share this post


Link to post
Share on other sites

The post I linked was wrong. I updated my post with the proper code. Sorry. :)

Share this post


Link to post
Share on other sites

No worries, I'll give it a try. I just get irked sometimes with the "Use the search function" stuff when I'm looking for info on the new content and there isn't any good info on them, or it's untested or the search function always returns irrelevant garbage. I was just frustrated because I spent about 2 hours trying to work out the code and searching to no avail beforehand.

EDIT

Well it's working, but not with 'this'. I have to use the chopper's variable name.

Share this post


Link to post
Share on other sites

Also, if you want the doors to be an addaction rather than a radio command without having to make a script, use:

this animateDoor ["doors1", 1, false]

The array is the door name (Doors1 is for both doors on the UH-80), the phase (number) and now (boolean, so True/false) no idea what the last two are for, they don't seem to effect the function or behavior of the doors when activated.

Share this post


Link to post
Share on other sites

Alright, what am I doing wrong... I hate having to use 3 separate open scripts... This method works, but is highly cumbersome IMO. With or without veh = this, using this in the script will NOT open the doors (this animateDoor...etc). I have to use the variable name.

Ghosthawk "A"

veh = this addAction["<t color=#FE2E2E'>REMOTE: Open Doors</t>", "OpenA.sqf];

OpenA.sqf

A animateDoor ['door_R', 1];

A animateDoor ['door_L', 1];

Question two, is there some way to use an If Then Else to check if the doors are open/closed and open or close them accordingly so I only have to use a single script for each bird with one addAction instead of two?

Question three, has anyone modified Tophe's vehicle respawn script (or know a workaround) to get the addActions applied to respawned choppers? Obviously the EH respawn and mprespawn's can't be used since a new vehicle is being created. Maybe an If statement that checks the type of vehicle?

Share this post


Link to post
Share on other sites

That code as written is working for me.

Two: Sure, you can use addAction conditions, which you'd want to use so it'll say Open or Closed as needed. You'll need two addActions but you'll only see the proper one.

Three: Not sure, but I think so? Check his thread.

---------- Post added at 03:42 PM ---------- Previous post was at 03:14 PM ----------

AddActions on the ghosthawk:

veh = this addAction["<t color='#FE2E2E'>REMOTE: Open Doors</t>", "ghostDoors.sqf",1,1,false,true,"","(_target animationPhase 'Door_R' == 0) && (_target animationPhase 'Door_L' == 0)"]; 
veh = this addAction["<t color='#FE2E2E'>REMOTE: Close Doors</t>", "ghostDoors.sqf",0,1,false,true,"","(_target animationPhase 'Door_R' == 1) && (_target animationPhase 'Door_L' == 1)"];

ghostDoors.sqf:

_ghost = _this select 0;
_state = _this select 3;
_ghost animateDoor ['door_R', _state];
_ghost animateDoor ['door_L', _state];

Share this post


Link to post
Share on other sites

Sweet, that's what I was looking for. One script to rule them all! Made a minor addition (without getting into If Then Else to be specific with open/close) to notify the pilot that the doors are moving.

Now all I've gotta get working is for them to re-apply after respawn with Tophe's script...

hintSilent "Doors Cycling";
_ghost = _this select 0;
_state = _this select 3;
_ghost animateDoor ['door_R', _state];
_ghost animateDoor ['door_L', _state];
sleep 1.75;
hintSilent "Cycle Complete";
sleep 1.75;
hintSilent "";

EDIT

Slight bug, if someone uses the actual Arma 3 Open command, you cannot remotely close the doors (the option won't display) until you manually close them with the Arma 3 command at which point you can cycle the two remote commands again. In the short term the pilots will just have to open their doors during their final flare.

---------- Post added at 22:52 ---------- Previous post was at 21:32 ----------

Got it all working with respawn! Thanks for your help! Will edit the first post for future mission makers!

Edited by Kahna

Share this post


Link to post
Share on other sites

Hi

I've tried editing this script to my needs but I simply cannot make it work.

What I'm trying to make is when a trigger activates the door of the helicopter open.

Any help?

Share this post


Link to post
Share on other sites

Which helicopter, if it's the ghosthawk then just put

this animateDoor ['door_R', 1]; 
this animateDoor ['door_L', 1];

(on the first page)

in the onAct box.

If it's another helicopter then you'll need to find the right names but I'm not sure where.

Share this post


Link to post
Share on other sites
Which helicopter, if it's the ghosthawk then just put

this animateDoor ['door_R', 1]; 
this animateDoor ['door_L', 1];

(on the first page)

in the onAct box.

If it's another helicopter then you'll need to find the right names but I'm not sure where.

Oh... I feel so stupid now... thanks

Where can I find the names for the other helicopters? :)

Share this post


Link to post
Share on other sites

Could something from this thread work in the form of spawning a Huron from the latest Dev Branch with it's cargo door open?

Share this post


Link to post
Share on other sites

Hey guys - i've been scouring the web now for some time and this is the thread closest to what i need. It didnt give me the answer i needed tho, but in hopes that some of you might know, i'll ask here.

Im trying to get a UH-60 blackhawks doors to open by trigger. It does have the animations as an option when your sitting in it, but i want them to open before "the divers are dropped off into the sea" as part of an insertion in a mission im making. I know the code is the same as for the ghosthawk as you have shown us in here, but i cant for the love of god find any place naming the exact name for the doors.

I've gotten a modded version of the Merlins doors to open, i've gotten the Ghosthawks doors to open - but i cant get the bloody doors to pen because i dont have the correct name for them.

Help anyone?

Share this post


Link to post
Share on other sites
Hey guys - i've been scouring the web now for some time and this is the thread closest to what i need. It didnt give me the answer i needed tho, but in hopes that some of you might know, i'll ask here.

Im trying to get a UH-60 blackhawks doors to open by trigger. It does have the animations as an option when your sitting in it, but i want them to open before "the divers are dropped off into the sea" as part of an insertion in a mission im making. I know the code is the same as for the ghosthawk as you have shown us in here, but i cant for the love of god find any place naming the exact name for the doors.

I've gotten a modded version of the Merlins doors to open, i've gotten the Ghosthawks doors to open - but i cant get the bloody doors to pen because i dont have the correct name for them.

Help anyone?

Use the config viewer in game with the mod that contains the UH-60 running to find out what the door names are.

Share this post


Link to post
Share on other sites
Use the config viewer in game with the mod that contains the UH-60 running to find out what the door names are.

This didn't work for the Ch-47F in the RHS USAF mod pack, the cargo door has no name it shows up as "cargoDoor[] = {}". No amount of tinkering with the script ever produces any results, however you can open the door if you are already in it. There doesn't seem to be a way to spawn it with the door open nor script it to open at the beginning of the mission. Does anyone have a suggestion, I have searched all over and I keep coming up empty.

Share this post


Link to post
Share on other sites

You need to open up the configViewer and look under the vehicles AnimationSources.

RHS_UH60M_d

_vehicle animateDoor [ "DoorL", 1 ];	//CoPilot door
_vehicle animateDoor [ "DoorR", 1 ];	//Pilot door
_vehicle animateDoor [ "DoorLB", 1 ];	//Left cargo door
_vehicle animateDoor [ "DoorRB", 1 ];	//Right cargo door

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  

×