Jump to content
Sign in to follow this  
PicVert

New question about eventhandlers

Recommended Posts

I would make an event when my plane detect and Incomingmissile and an other for getdammage (I think is hit ?) and an other one for "if getdammage .7 then eject"

confused.gif some one could help me to make the apropriate Eventhandlers...

That is what I've made but it does'nt work  crazy.gif  sad.gif

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class CfgRadio

{

class danger

{

  sound[]={\XXXXX\danger.wav,db5,1};

  name = "danger";

  title =;

};

};

class CfgSounds

{

class Ejection

{

name="Ejection";

sound[]={"\XXXXX\Ejection.wav",1.00000,1.000000};

titles[]={};

};

class warn

{

name="warn";

sound[]={"\XXXXX\warn.wav",1.00000,1.000000};

titles[]={};

};

};

      class EventHandlers

      {

gear = "if (_this Select 1) then {(_this Select 0) Animate [""LeftGear"", 0]; (_this Select 0) Animate [""RightGear"", 0]; (_this Select 0) Animate [""NoseGear"", 0]} else {(_this Select 0) Animate [""LeftGear"", 1]; (_this Select 0) Animate [""RightGear"", 1]; (_this Select 0) Animate [""NoseGear"", 1]}";

IncomingMissile = "(_this select 0) say ""warn""";

Hit = "if (GetDammage (_this select 0) > 0.5 ) then {(_this select 0) vehicleRadio ""danger""})";

getout = "if ( getpos (_this select 0) select 2 > 20 then {(_this select 2) say ""Ejection""})";

      };

<span id='postcolor'>

confused.gif an idea confused.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 (PicVert @ Mar. 14 2003,06:47)</td></tr><tr><td id="QUOTE">

IncomingMissile = "(_this select 0) say ""warn""";

Hit = "if (GetDammage (_this select 0) > 0.5 ) then {(_this select 0) vehicleRadio ""danger""})";

getout = "if ( getpos (_this select 0) select 2 > 20 then {(_this select 2) say ""Ejection""})";

      };

confused.gif an idea confused.gif<span id='postcolor'>

should be

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

hit = "if ((GetDammage (_this select 0)) >= 0.5 ) then {(_this select 0) vehicleRadio ""danger""}";

getout = "if ((getpos ((_this select 0) select 2)) >= 20) then {(_this select 2) say ""Ejection""}";

<span id='postcolor'>

try that and see if it helps. Also, you might try the

"Dammaged" event handler instead of "hit"

Share this post


Link to post
Share on other sites

thx, Incomming missile work fine but I have that message for GETOUT when pilot is using eject :

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">

'if ((getpos ((_tis select 0) select 2)) select2)) >=¦#¦ 20) the {(_this select 2) say "Ejection"}': Error select: Type Object, expected Array<span id='postcolor'>

and for HIT nothing wrong but no sound confused.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>Code Sample </td></tr><tr><td id="CODE">'if ((getpos ((_tis select 0) select 2)) select2)) >=¦#¦ 20) the {(_this select 2) say "Ejection"}': Error select: Type Object, expected Array<span id='postcolor'>

1. you wrote _tis instead of _this.

2. You have two select 2 in there, why that.

3. it is called then not the

Try the exact code mentioned above.

Share this post


Link to post
Share on other sites

hello Rastavovish smile.gif

that is my events but it does'nt work confused.gif

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class EventHandlers

{

IncomingMissile = "(_this select 0) say ""warn""";

hit = "if ((GetDammage (_this select 0)) >= .1 ) then {(_this select 0) vehicleRadio ""danger""}";

getout = "if ((getpos ((_this select 0) select 2)) >= 20) then {(_this select 2) say ""Ejection""}";

}

<span id='postcolor'>

for hit I hurd no sound confused.gif

and for getout the message is like I wrote before tounge.gif not exactly

I mine select 2 is the pilot when is ejected maybe that is what I have read in other post.

some one can correct my code. plz.

Share this post


Link to post
Share on other sites

Well for Hit you didn't define a sound for it to say, you

just used vehicle radio. also in the getout part

this select 0 = the plane

this select 1 = the unit getting out

this select 2 = nothing at all

Share this post


Link to post
Share on other sites

I have modified like that but no sound and bug :

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

hit = "if ((GetDammage (_this select 0)) >= .1 ) then {_this select 1) say ""danger""}";

getout = "if ((getpos ((_this select 0) select 1)) >= 20) then {(_this select 1) say ""Ejection""}";

<span id='postcolor'>

1. hit = doesnt play sound confused.gif

2. getout = bug confused.gif :

'if ((getpos ((_this select 0) select 1) >=¦#¦ 20) then {(_this select 1) say "Ejection"}': Error selct: Type Object, expected Array

I would try some other defines but if you found a solution for me that was nice 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 (PicVert @ Mar. 17 2003,09:40)</td></tr><tr><td id="QUOTE">'if ((getpos ((_this select 0) select 1) >=¦#¦ 20) then {(_this select 1) say "Ejection"}': Error selct: Type Object, expected<span id='postcolor'>

should be:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">if ((getpos (_this select 0)) select 2 >= 20) then {(_this select 1) say "Ejection"}

<span id='postcolor'>

Share this post


Link to post
Share on other sites

that is my config :

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class CfgSounds

{

class Ejection

{

name="Ejection";

sound[]={"\XXX\Ejection.wav",1.00000,1.000000};

titles[]={};

};

class danger

{

name="danger";

sound[]={"\XXX\danger.wav",1.00000,1.000000};

titles[]={};

};

};

class EventHandlers

{

hit = "if ((GetDammage (_this select 0)) >= .1 ) then {(_this select 1) say ""danger""}";

getout = "if ((getpos (_this select 0)) select 2 >=20) then {(_this select 1) say ""Ejection""}";

};

<span id='postcolor'>

When I get dammage no sound confused.gif and when I'll getout that is the bug message : '(_this select 1) say "Ejection"¦#¦': Error say: Type String, expected Object

crazy.gif

Share this post


Link to post
Share on other sites
Guest BratZ

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (PicVert @ Mar. 18 2003,19:31)</td></tr><tr><td id="QUOTE">class EventHandlers

{

hit = "if ((GetDammage (_this select 0)) >= .1 ) then {(_this select 1) say ""danger""}";

getout = "if ((getpos (_this select 0)) select 2 >=20) then {(_this select 1) say ""Ejection""}";

};

[/code]

When I get dammage no sound confused.gif and when I'll getout that is the bug message : '(_this select 1) say "Ejection"¦#¦': Error say: Type String, expected Object

crazy.gif<span id='postcolor'>

I thought by using the "hit? eventhandler that it returns 2 things:

"Hit" object:causedBy,scalar:howMuch

hit = "if (_this select 1) >= .1 then say ""danger""}";

"GetOut" string:position (1),object:unit

getout = "if (((getpos (_this select 1)) select 2) >=20 then {(_this select 1) say ""Ejection""}";

From what I see you are trying to access the vehicle as _this but coming from the eventhandler its not referring to the vehicle that way, _this select is now the eventhandler output

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  

×