Jump to content
Sign in to follow this  
Feint

MH-9 Door Control

Recommended Posts

MH9-control-03_LR.jpg

"MH-9 Door Control" FOR ARMA 3: ALPHA

VERSION 1.0

CREATED BY FEINT

Contacts:

=================

Website: http://www.jonhillenbrand.com

Facebook: http://fb.com/feintgames/

Required game: Arma3: Alpha (dev)

=================

Tested with Arma 3: Alpha version 0.53.103507 (I think - it's hard to read)

Required addons:

=================

none

Description:

=================

This is a pair of scripts which will enable the following:

  • Adds doors to MH-9
  • Adds ability to open and close doors individually
  • Demonstrate how to use a single script for 8 separate actions

This is purely an example set of scripts to help teach people some basic scripting on animations and to add some functionality to the built in MH-9 that didn't exist in Arma 3 Alpha. I hope someone finds it useful. I've added annotations to the scripts where I thought it would be most useful in order to show what is going on. I know over the years that I've looked at other people's scripting to figure out how to do things. So this is just me giving back to the community as much as possible. I hope you enjoy it.

Example mission included.

Installation:

=================

Copy and past the mission into your missions folder. Open in the editor and enjoy.

Credits:

=================

Feint and the Biki

Disclaimer/License:

=================

By use of this addon, you agree to the following:

You are using these files at your own risk.

Author(s) of those files are not liable for any damage or loss of data caused by use of these files.

Usage of these files is prohibited for any commercial purposes.

VIDEO:

=================

Here is a video with a WIP version of these doors

DOWNLOAD HERE:

MH-9_DOOR_CONTROL.rar

MIRRORS:

news_download_a3_3.png

MH-9 Door Control [ALPHA] v1.0

Edited by Feint
ADDED MIRROR INFO
  • Like 1

Share this post


Link to post
Share on other sites

Thank you soo much for this, I've been working with the editor for about 2 or 3 weeks or so now, and im starting to get the hang of it now.

This will help me to understand the scripting a lot better, so I'm thanking you greatly for this post :)

Thanks for sharing your Help and Knowledge towards the community!

Share this post


Link to post
Share on other sites
Thank you soo much for this, I've been working with the editor for about 2 or 3 weeks or so now, and im starting to get the hang of it now.

This will help me to understand the scripting a lot better, so I'm thanking you greatly for this post :)

Thanks for sharing your Help and Knowledge towards the community!

No problem. Happy to help people just starting out. If you have any questions about what I've done, please feel free to ask in this thread or PM me.

Share this post


Link to post
Share on other sites

HI

First i have to say that i am not familiar with scripting and so on.

So i have a little Question.

It is not possible to create a pho-File that allows to use the Addon on Stratis and other Maps without having to load a Mission?

Kind Regards

(ST6)Predator

Share this post


Link to post
Share on other sites
HI

First i have to say that i am not familiar with scripting and so on.

So i have a little Question.

It is not possible to create a pho-File that allows to use the Addon on Stratis and other Maps without having to load a Mission?

Kind Regards

(ST6)Predator

I am not familiar with how .pho files function, but what your asking is a little strange to me and might be beyond the scope of this thread. This thread is mainly meant to show what can be done within the editor along with a few scripts. I've not created a new addon, i.e. a new standalone vehicle with opening doors. The scripts available in the download will show how to use content that is already available in the games files, and with a little creative wrangling, you can add new functionality to the game that wasn't there before. Does that make sense?

Of course, I could have made a new config with this functionality built in and released it as an addon so people could just place the new helicopter with opening and closing doors already built in, but then it wouldn't be as easy for people to learn.

I think .pho files are something new to me and maybe new to Arma editing in general. If you know how to do it, by all means I would post your findings in a new thread. Sounds interesting.

Share this post


Link to post
Share on other sites

All addons (and original content for that matter) are in pbo file format, they have been since OFP :) Esssentially you've added the user interaction to open and close the doors, which can also be achieved via a small config addon by the addition of the following:

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

(This isn't to detract from your excellent work at all, Feint, just pointing out that the utility could be achieved in addon form as well, but I understand and applaud your approach to doing it via scripts and the editor to let people look and learn)

Share this post


Link to post
Share on other sites
All addons (and original content for that matter) are in pbo file format, they have been since OFP :) Esssentially you've added the user interaction to open and close the doors, which can also be achieved via a small config addon by the addition of the following:

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

ST6Predator wrote .pho, not pbo. But now I'm realizing that it was a typo on his/her part. So yeah. By the way, I know what pbos are as I've authored many addons for many years (see sig). LOL

Either way, thanks for posting that link. I think that will also help people come to grips with this stuff. :)

Edited by Feint

Share this post


Link to post
Share on other sites

mh doors - nice to have.... the problem is need it you ? when all can go in go out when the door is closed :( ? nice feature, only in out when doors are open this is what i will see in arma 3. i deed no new in out animation - the function alone is nice

Share this post


Link to post
Share on other sites

yeah i'd be better if there was added functionality where you couldn't exit unless you opened the door first.

Share this post


Link to post
Share on other sites

The useraction can just as easily be tied to locking and unlocking the vehicle at the same time as opening the doors. Use some imagination, that's the point of these open source scripts.

Share this post


Link to post
Share on other sites

Now instead of the script just being for choppers, how about it 'recognising' the vehicle and number of doors that CAN animate, then adding the action to the vehicle? What do you think Feint?

Share this post


Link to post
Share on other sites
Now instead of the script just being for choppers, how about it 'recognising' the vehicle and number of doors that CAN animate, then adding the action to the vehicle? What do you think Feint?

I think there's a lot that can be done with getText but I'm not a big expert on that. Part of the problem is that there are no standardized names for doors like "Door0","door1", etc. All of the door names are proprietary to that particular class of vehicle. Maybe someone smarter than I could write a script to use getText to find anything that can be animated in a model, but to have that happen automatically depending on the vehicle is beyond my skills. I'm not sure that's even possible, but I won't go so far as to say it's impossible as this engine is pretty flexible.

Share this post


Link to post
Share on other sites
The useraction can just as easily be tied to locking and unlocking the vehicle at the same time as opening the doors. Use some imagination, that's the point of these open source scripts.

imagination doesn't make things happen, effort and work makes it happen. you should show more respect to a guy who provided this mod free for you.

Share this post


Link to post
Share on other sites
imagination doesn't make things happen, effort and work makes it happen. you should show more respect to a guy who provided this mod free for you.

I was talking to you - instead of being spoon fed everything, why not use some of your effort and work and try doing it yourself?

Share this post


Link to post
Share on other sites

I was changing the script a bit to disable the bench seats (Just by locking them) and making every door lock/unlock the seat it's next to, however I can't figure out how to lock the copilot seat. Any idea?

I tried to figure it out by using player moveInTurret / moveInGunner / moveInCargo but I can't figure out which seat is the gunner seat. Could anyone example of how I go about figuring out which seats a vehicle has (Like if I'm in a certain seat that I type a command / execute a script to display the seat I'm in in the text area or so, or even something that just gives me a list of all available seats in a vehicle

I already did the following to lock the benches

_targetChoppa lockCargo [2, true];

_targetChoppa lockCargo [3, true];

_targetChoppa lockCargo [4, true];

_targetChoppa lockCargo [5, true];

Edit: Another question: Right now I can always get out even though the door right next to the seat I'm in is locked. Is it possible to remove the get out function if the door right next to you is closed? I know I can do it by locking the entire vehicle, but I'm curious if you can do it this way. I'd love having to open/close doors before getting in and out first.

@Feint. How did you figure out how which doors the MH-9 has? I'm curious about opening / closing doors of vehicles also. Do I need to use one of the tools from BI for this?

Edited by Adanteh

Share this post


Link to post
Share on other sites
I was changing the script a bit to disable the bench seats (Just by locking them) and making every door lock/unlock the seat it's next to, however I can't figure out how to lock the copilot seat. Any idea?

I tried to figure it out by using player moveInTurret / moveInGunner / moveInCargo but I can't figure out which seat is the gunner seat. Could anyone example of how I go about figuring out which seats a vehicle has (Like if I'm in a certain seat that I type a command / execute a script to display the seat I'm in in the text area or so, or even something that just gives me a list of all available seats in a vehicle

I assume you already tried _targetChoppa lockCargo [1, true]; to try and lock that front right passenger seat, right?

And you already tried lockTurret, right?

Hmm. I wonder if there's a way to just remove the action so that it's not possible to even try to get in. If it's possible to find the action ID for that gunner seat, then you could just remove it. But I don't know how to do that.

Edit: Another question: Right now I can always get out even though the door right next to the seat I'm in is locked. Is it possible to remove the get out function if the door right next to you is closed? I know I can do it by locking the entire vehicle, but I'm curious if you can do it this way. I'd love having to open/close doors before getting in and out first.

Good question. I don't know off the top of my head. If you want it to happen automatically (like when you hit the GetOut key), I'd explore using an eventhandler with that specific aircraft to run a script that opens the door when you get out. It would look something like this:

[color=#000000][font=sans-serif]_helicoptername [/font][/color][b]addEventHandler [getOut, "pathToGetOutDoorFile.sqf"];
[/b]

And then pathToGetOutDoorFile.sqf:

// insert your private line here

// GET THE STUFF PASSED TO THIS SCRIPT FROM THE EVENT HANDLER
_vehicle = _this select 0;
_position = _this select 1;
_unit = _this select 2;

// FIND THE DOOR THAT SHOULD OPEN [color=#000000][font=sans-serif]"driver", "gunner", "commander" or "cargo"[/font][/color]
if (_position == "driver") then
{
_vehicle animateDoor [(WHATEVER THE DRIVERS DOOR IS),1];
};

if (_position == "gunner") then
{
_vehicle animateDoor [(WHATEVER THE GUNNER DOOR IS),1];
};

// ETC.

Unfortunately, I would guess that the timing might be off with the door opening too slowly for the unit exiting the vehicle. So I would add this to the script and see if it works:


// CHECK IF THE DOOR IS NOT OPEN YET
while {!(animationState nameOfDoor == 1)} do
{
_unit switchMove "nameOfHelicopterDriverOrCargoAnimation";
sleep 0.1;
};

Of course, all of this might just be a fools errand if BI implements a special getOut move for helicopters with doors. I'm not sure how it works in TOH, but it would be worthwhile to use Eliteness (see below) to explore how those people get in and out of helicopters. Maybe the getOut action in TOH has a check to see if the helicopter has doors and if so to animate those doors and to wait until that animation is finished.

@Feint. How did you figure out how which doors the MH-9 has? I'm curious about opening / closing doors of vehicles also. Do I need to use one of the tools from BI for this?

I used an amazing program called Eliteness to unpbo the pbos and then to look at the animation names.

You can grab Eliteness and depbo (which it needs to function) here:

https://dev-heaven.net/projects/mikero-pbodll/files

I also found this in the TOH forums which describes all of the animations available for their helicopters:

http://forums.bistudio.com/showthread.php?127119-Doors-Off

Side note: Has anyone tried animateDoor instead of animate for the doors? I haven't tried it yet and am wondering what the difference is. Maybe the door knob rotates before and after the door moves if you use animateDoor.

Share this post


Link to post
Share on other sites
I assume you already tried _targetChoppa lockCargo [1, true]; to try and lock that front right passenger seat, right?

And you already tried lockTurret, right?

Hmm. I wonder if there's a way to just remove the action so that it's not possible to even try to get in. If it's possible to find the action ID for that gunner seat, then you could just remove it. But I don't know how to do that.

Yes. Cargo spot number 0 is for the left rear seat and cargo spot number 1 is for the right rear seat. I tried lockTurret and lockGunner and lockCommander and also tried going higher with lockCargo, but no luck. I was trying to find the location with player moveIn<whatever> but no luck with any of that. I got eliteness to work (Was using an old version which crashed with new depbo) and it says there is getin_cargo to getin_cargo6, getin_pilot and getin_turret. I'm guessing get in turret should work fine.

Good question. I don't know off the top of my head. If you want it to happen automatically (like when you hit the GetOut key), I'd explore using an eventhandler with that specific aircraft to run a script that opens the door when you get out. It would look something like this:

[color=#000000][font=sans-serif]_helicoptername [/font][/color][b]addEventHandler [getOut, "pathToGetOutDoorFile.sqf"];
[/b]

And then pathToGetOutDoorFile.sqf:

// insert your private line here

// GET THE STUFF PASSED TO THIS SCRIPT FROM THE EVENT HANDLER
_vehicle = _this select 0;
_position = _this select 1;
_unit = _this select 2;

// FIND THE DOOR THAT SHOULD OPEN [color=#000000][font=sans-serif]"driver", "gunner", "commander" or "cargo"[/font][/color]
if (_position == "driver") then
{
_vehicle animateDoor [(WHATEVER THE DRIVERS DOOR IS),1];
};

if (_position == "gunner") then
{
_vehicle animateDoor [(WHATEVER THE GUNNER DOOR IS),1];
};

// ETC.

Unfortunately, I would guess that the timing might be off with the door opening too slowly for the unit exiting the vehicle. So I would add this to the script and see if it works:


// CHECK IF THE DOOR IS NOT OPEN YET
while {!(animationState nameOfDoor == 1)} do
{
_unit switchMove "nameOfHelicopterDriverOrCargoAnimation";
sleep 0.1;
};

Thanks a lot for the quick response. I'll see if I can get this to work as I want it.

Where exactly did you find the animations using Eliteness though or did you use the post from DnA for that?

_______________________

EDIT

_______________________

I just failed with the Turret formatting. Put the following in one of the watch fields

assignedVehicleRole player

which gave me a nice return of ["turret", [0]];

I added it to the closing of the right front door

_targetChoppa lockTurret [[0], true];	

and then the false to the opening and it works fine now.

Still pretty weird, seeing all possible positions should be closed when doors are closed (All the bench positions are by default locked and can't be opened) and I'm still able to get out. Would it be possible to do a check if all doors are closed and then lock the complete vehicle if that is the case? Or do I lose the ability to open the doors again then?

Thanks for the help. This is the very first scripting I'm doing and really have no idea what I'm doing. Any recommend reads to actually know how to make things? I really have no idea what all the variable names, defines and private things and so are for.

Edited by Adanteh

Share this post


Link to post
Share on other sites

Where exactly did you find the animations using Eliteness though or did you use the post from DnA for that?

Would it be possible to do a check if all doors are closed and then lock the complete vehicle if that is the case? Or do I lose the ability to open the doors again then?

Thanks for the help. This is the very first scripting I'm doing and really have no idea what I'm doing. Any recommend reads to actually know how to make things? I really have no idea what all the variable names, defines and private things and so are for.

I found the animation names in the config for the helicopter. Eliteness will let you look at the config if you double click on it. Sometimes when I want to search a config but I'm in Eliteness (which doesn't have a search function), I'll copy and paste the config into a text editor and do my searching that way. It really speeds things up.

If the vehicle is locked, I would guess that you can still get out, but you can't get in. But I haven't tested this. I'd just keep pecking at it and test a lot. That's what I do.

Recommendations on where to go to learn this stuff? My first recommendation would be to download and use Squint. It's helped me more than any reference. Second, I'd just keep looking at what other people are doing and using Eliteness to look at how they've coded things. I'd alos keep that BI Wiki close at hand. There are also tutorials on YouTube and scattered all over the place that might help with some of the basics. But really, for me it's been trial and error. There's still a lot for me to learn, especially when it comes to multiplayer coding, locality, public variables, and all of that complicated stuff.

Share this post


Link to post
Share on other sites

Have you seen the script by BlenderRus Feint that allows get in actions from above? Thought about that using your neat scripts ?

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  

×