Jump to content
Sign in to follow this  
nominesine

Removing parachutes

Recommended Posts

I have searched and searched to no avail... Is it possible to remove a helicopter pilots parachute with a script? I know there are addons who does the trick, but my mission is supposed to be addon free.

Share this post


Link to post
Share on other sites

So if they eject they just die or? Would just locking the bird be enough?

Share this post


Link to post
Share on other sites
I have searched and searched to no avail... Is it possible to remove a helicopter pilots parachute with a script? I know there are addons who does the trick, but my mission is supposed to be addon free.

A little sqs script i used in my WW1 mod in OFP (to remove parachute from WW1 pilots), you can adapt it through sqf in ArmA2. I add it with a getout eventhandler :

;this addeventandler ["getout",  {[_this] exec {eject.sqs}}]


_array = _this select 0 
_plane = _array select 0
_pilot = _array select 2

?(speed _plane < 1) : exit

_oldpara = vehicle _pilot
_pilot action ["GETOUT", _oldpara]

deletevehicle _oldpara

exit

Share this post


Link to post
Share on other sites
A little sqs script i used in my WW1 mod in OFP (to remove parachute from WW1 pilots), you can adapt it through sqf in ArmA2.

Thanks. A good old sqs will do just fine

So if they eject they just die or? Would just locking the bird be enough?

Does locking really prevent AI and players from ejecting? In that case all I need is a repeating trigger that locks the vehicle while it is moving, and unlocks it when it's speed reaches 0. I'll try that as well.

Edited by nominesine

Share this post


Link to post
Share on other sites

My apologies for resurrecting such an old thread, but I managed to solve this problem using a simple script which appears to work both with players and A.I., in both single-player and multi-player. It consists of a trigger which is set to "repeatedly", containing the following (where "gunship1" is the name I gave to the aircraft, and where "6" is the altitude above which ejecting is disallowed):

Condition: (getPos gunship1 select 2) > 6

On Act.: gunship1 setVehicleLock "LOCKED"

On Deact: gunship1 setVehicleLock "UNLOCKED"

If you like, you can selectively allow ejecting for certain positions and not others. For example, in a C-130 you could allow the passengers to eject for paradrops, while still disabling it for the crew, by using the lockDriver et al. commands. (For the C-130, I would change the altitude from 6 to 0, and perhaps create a speed limit as well) By using the lockCargo [cargo index, lock] function, you could even deny parachutes to only certain passenger positions (for example, the co-pilot's seat and the one in between the pilot and co-pilot). I allow ejection from my helicopters at 6 meters or below, because at that altitude there is no parachute when you eject. At 5 meters they die from the fall; at 4 meters they can survive with wounds if horizontal and vertical speed is low. It's especially useful for transport helicopters, which can hover 2 meters above the ground to let out the troops without actually landing.

Edited by Echo38

Share this post


Link to post
Share on other sites

Damn! It doesn't work for A.I. My initial tests were misleading. In that case, it probably also will stop working for players when they are given dismount orders.

Share this post


Link to post
Share on other sites

Maybe this works for you.

// Use this init line:
// this addEventHandler ["GetOut", "nul=[this] execVM 'noEject.sqf'"];

_veh = _this select 0;
_pos = _this select 1;
_unit = _this select 2;

if (speed _veh < 1) exitWith { false };

switch(_pos) do 
{
 case "driver":
 {
   _unit assignAsDriver _veh;
   _unit moveInDriver _veh;
 };

 case "gunner":
 {
   _unit assignAsGunner _veh;
   _unit moveInGunner _veh;
 };

 case "commander":
 {
   _unit assignAsCommander _veh;
   _unit moveInCommander _veh;
 };

 case "cargo":
 {
   _unit assignAsCargo _veh;
   _unit moveInCargo _veh;
 };
};

That should simply move them back into the vehicle if they eject.

Share this post


Link to post
Share on other sites

Thank you, Tajin. Unfortunately, that script should leave the parachutes floating down empty; I created a few triggers which simply move them back into the aircraft, and that's what happens. I can't figure out how to identify the parachutes to delete them; maybe some sort of "foreach thislist" thing?

Right now I've got a very kludgy workaround that I'm not happy with; if the altitude is greater than 6 and less than 29, it does a double deletevehicle, which deletes the parachute (if any) and the character, and then it explodes the helicopter. The reason I had to do the double and explosion is that, when I only had one deletevehicle and no explosion, they were sometimes visually exiting the helicopter and then disappearing into the air (because at certain altitudes, they eject without a parachute even without scripts and triggers, and a character not in a vehicle is considered by the deletevehicle command to be a vehicle). The explosion at least provides a distraction. Aside from looking a bit silly, the obvious problem with this is that the helicopter and any players remaining in it are destroyed.

If only there were a command like deletevehicle, except which doesn't delete a character when he is not in a vehicle. Or a way to point the deletevehicle command at the parachutes floating down empty.

Edited by Echo38

Share this post


Link to post
Share on other sites

Oh, right. I forgot about the parachutes.

Here, that should get rid of em:

// Use this init line:
// this addEventHandler ["GetOut", "nul=[this] execVM 'noEject.sqf'"];

_veh = _this select 0;
_pos = _this select 1;
_unit = _this select 2;

if (speed _veh < 1) exitWith { false };

if (vehicle _unit != _unit) then {
 deleteVehicle vehicle _unit;
};

switch(_pos) do 
{
 case "driver":
 {
   _unit assignAsDriver _veh;
   _unit moveInDriver _veh;
 };

 case "gunner":
 {
   _unit assignAsGunner _veh;
   _unit moveInGunner _veh;
 };

 case "commander":
 {
   _unit assignAsCommander _veh;
   _unit moveInCommander _veh;
 };

 case "cargo":
 {
   _unit assignAsCargo _veh;
   _unit moveInCargo _veh;
 };
};

Share this post


Link to post
Share on other sites
if (vehicle _unit != _unit) then {

deleteVehicle vehicle _unit;

};

I'd tried that with a trigger, but it deleted the man if he wasn't in a parachute, even though the vehicle pilot1 != pilot1 should have meant that the man was not deleted but only any vehicle he was in.

Also, could you explain what each of the parts of your script does? For example, I can't figure out what the "select 2" etc. does in this case; the command reference example doesn't seem to explain what you're doing with it here.

Share this post


Link to post
Share on other sites

Ok, here are the relevant parts from the wiki:

http://community.bistudio.com/wiki/addEventHandler

http://community.bistudio.com/wiki/ArmA_2:_Event_Handlers#GetOut

The "GetOut"-eventhandler that I'm using fires whenever a unit exits the given vehicle. That evenhandler passes 3 parameters.:

1. The vehicle itself

2. The position from which the unit left the vehicle (crew, driver, etc..)

3. The unit who left the vehicle ( _unit = _this select 2; )

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  

×