Jump to content
Sign in to follow this  
Laitex

Detecting emergency ejection from planes

Recommended Posts

I want to detect "emergency ejection from Planes" and to play ejecting sound. Is there any way to detect emergency ejection from planes with scripts?

There are some fighter add-ons which react against incoming missile and alerm. That effect is dealt with in class EventHandlers.

class EventHandlers

{

};

Is there any way to deal with emergency ejection in class EventHandlers?

Share this post


Link to post
Share on other sites

you could check via script if a driver is still the driver of his plane. When he is not and the plane has speed > 0 or height > 0 then he surely ejected.

Share this post


Link to post
Share on other sites

Thanks!

By the way, is that script defined in map or in each add-on?

If in add-on, don't you use "class EventHandlers"?

Share this post


Link to post
Share on other sites

p.s.

I hear that EventHandlers has "Getout" handler. It returns "position" and "unit". Can you use that handler to judge whether he ejected or merely get out?

Share this post


Link to post
Share on other sites

The script would be in the addon .pbo and would be called over the init-event handler.

True, you could also try it over the getout-eh.

Share this post


Link to post
Share on other sites

get out can work i guess but the easy way would just be to do the get out event handler and then add speed > 20 or something so it wouldnt call it when u just get out of the plane.

either that or have the get out event handler call a script to check some more things on the plane like height and speed maybe if you would like it that way.

Share this post


Link to post
Share on other sites

> the plane has speed > 0 or height > 0

Yes, It is indicator of ejection, but you can not say whether he really pulls emergency ejection lever. Even aircraft which is destroyed in the air would throw pilot and gunner although they do not pull ejection lever. confused.gif

Is there any direct way to detect whether he pulls ejection lever( select "eject" in action menu )?

Share this post


Link to post
Share on other sites

actually there is no "pulling the ejection lever" when the plane is moving at a speed over one the only option is eject anyways so i dont see what the problem is?

Share this post


Link to post
Share on other sites

o.k. Thanks.

Well, I am not so familier with script. Is the easiest way to define EventHandler "Getout" in class vehicle, like this?

class CfgVehicles

{

class Chopper

{

class EventHandlers

{

getout="if (speed > 0 && height > 0) then {vehicleRadio ""EjectionSound""}";

};

};

};

Share this post


Link to post
Share on other sites

height isnt a proper command you would have to check it through a script  but just use speed and put this in the event handler

"if ((_this select 0)==Speed > 0 and (_this select 1)) then {(_this select 0) vehicleRadio ""Geardown""}";

Share this post


Link to post
Share on other sites

I define class EventHandlers like this;

class fighter : Plane

{

class EventHandlers

{

GetOut="if ( (_this select 0)==Speed > 0 and (_this select 1)) then {(_this select 0) vehicleRadio ""EjectSound""}";

};

};

But following messages appears when I eject from plane;

"Invalid number expressions".

And no sound was played. Amazingly |#| appears between "Speed" and ">", that is say like this;

'if ( (_this select 0)==Speed |#|> 0 and (_this select 1)) then {(_this select 0) vehicleRadio ""EjectSound""}'; Invalid number expressions

Hmmmm....

By the way, in this case, what is _this select 0 and _this select 1?

Share this post


Link to post
Share on other sites

of course it is an invalid number in expression. You compare here two things at once.

First you check if _this select 0 == speed (which is completly wrong). Then you compare speed > 0 (which will not work, since the game engine does not know the speed of what).

Write:

Speed (_this select 0) > 0

instead, then it should work.

_this select 0 is allways the vehicle itself on eventhandlers.

_this select 1 is the position that was left, in your case "DRIVER"

Share this post


Link to post
Share on other sites

Thanks! biggrin.gif It seems to work good. But it also seems there is still some problem. confused.gif

Look, I write config.cpp as follows. I define "getout" and "getin". When you get out or get in, vehicleRadio "EjectSound" should be played. But actually, the sound was played only when I "getin" to the plane, and not when I "getout".

I am not sure, but "vehicleRadio" is played only when you are in vehicle, isn't it? This is why "getin" sound is played, but "getout" sound is not played? (Because after I get out, I AM outside of the plane.)

I want to play emergency ejection sound when you eject from the plane, that is to say sound should be palyed outside also. Is there any idea? confused.gif

class EventHandlers

{

getout="_this select 0 vehicleRadio ""EjectSound""";

getin="_this select 0 vehicleRadio ""EjectSound""";

};

class CfgRadio

{

class EjectSound

{

sound[]={"\Fighter\emergencyEjection.wss","db+10",1};

name="EjectSound";

title="";

};

Share this post


Link to post
Share on other sites

We may be able to use "Say" command instead of "vehicleRadio". We let "ejecting pilot" to "Say"(play) the emergency ejection sound (defined in class CfgSounds).

> _this select 0 is allways the vehicle itself on eventhandlers.

Hmmm... Is there any way to specify ejecting pilot, not the vehicle? If we can, following script is just o.k.

class EventHandlers

{

getout="ejectingPilot Say ""EjectSound""";

};

Share this post


Link to post
Share on other sites

> Is there any way to specify ejecting pilot, not the vehicle?

I found that _this select 2 is ejecting pilot. Thanks guys. smile.gif

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Rastavovich @ Jan. 19 2003,00:07)</td></tr><tr><td id="QUOTE">_this select 1 is the position that was left, in your case "DRIVER"<span id='postcolor'>

I am sorry, can I ask one more thing?

_this select 1 in "getout" means the position of vehicle.

Is it string? for example "driver", "gunner", and what about the position of cargo? "back"?

Share this post


Link to post
Share on other sites

dunno,maybe "CARGO", you have to test.

make a eventhandler that hints what position was left:

hint (_this select 1)

and leave that vehicle out of cargo position.

Share this post


Link to post
Share on other sites

I'm sorry to say that I forgot about choppers. Choppers can fly though its speed is equal to 0. To detect whether he jumps from the chopper, we have to examine chopper's height.

In the last discussion, we can detect speed easily( "Speed" command ), but there is no direct detecition of height. confused.gif

How can we know whether chopper is in the air or on the ground?

Share this post


Link to post
Share on other sites

No need for ejetion sound on choppers, unless you will create a Ka-50 or Ka-52 chopper. There are no other choppers with ejection seats.

detection of height is:

getpos choppername select 2

Return value: Height in meters.

Share this post


Link to post
Share on other sites

OFP:R has Ka-50(V-80). smile.gif

Of cource I will change Ka-50 ejection sound. I hear that Ka-50 blows up propellers when emergency ejection.

And thanks. biggrin.gif

Share this post


Link to post
Share on other sites

Thanks all. I have just applied what you tell to my add-on. Download it here.

Light Armaments Project Revision 1.3

This add-on adds emergency ejection sounds to A-10(LGB), CH47D, OH58, Kamov(Ka-50). Just eject from the cargo of CH47D. tounge.gif

In addition to ejection sounds, this add-on also change other sounds. You can get details at comments, and downloads page.

Thanks all again! smile.gif

My Webpage

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  

×