Jump to content
Sign in to follow this  
NAA_Us_Marine

Event handlers questions.

Recommended Posts

Ok guys for a long time now people havent known about using event handlers in there cpp but i would like to know how to use them and maybe start a sticky for a compilation of them for other people to use. I would like a Example or some input on a event handler for damage like in the ah-1 cobra how the light blinks and the sound goes off when you are damaged so please put what you know about this and snippets in this topic.

thx

Share this post


Link to post
Share on other sites

Well this is another bump of the topic still wondering about how they do the lights blinking on the ah-1.

Share this post


Link to post
Share on other sites

the damage light in the cockpit can be done by making a verticle and name it "poskozeni" when you are ingame and the helicopter gets damaged you probaly see the verticle flashing yellow

Share this post


Link to post
Share on other sites

yeah but i think that only means damage in czech and doesnt do anything but ill try it. what about event handlers like ones for firing a missile or stuff like that.

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 (NAA_Us_Marine @ Dec. 04 2002,23:30)</td></tr><tr><td id="QUOTE">yeah but i think that only means damage in czech and doesnt do anything but ill try it. what about event handlers like ones for firing a missile or stuff like that.<span id='postcolor'>

What I noticed is that it doesn't work for me, but it _does_ work in BIS's Cobra...

Share this post


Link to post
Share on other sites

Yes thats cause it is an event handler and that is just damage in czech i would also like to know how bis does the damage percentile thing on the ah-1 and the altitude and the speed displayed in numbers all like they did on the ah-1 could someone from bis please help us here?

Share this post


Link to post
Share on other sites

The BIS AH1 does not use event handlers for anything, they are all just selections/memory points in the model.

Share this post


Link to post
Share on other sites

The whole hud is apparently supposed to appear after placing the following points into memory lod:

HUD LH (for left top corner)

HUD PH (for right top corner)

HUD LD (for left bottom corner)

HUD PD (for right bottom corner)

Share this post


Link to post
Share on other sites

How do you code a second event?

I've setup the code as follows;

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

class Animations

{class Ltouterwing

{type="rotation";

animPeriod=2;

selection="lt outerwing";

axis="lt wing axis";

angle0=0;

angle1=-1.55;};

class Rtouterwing

{type="rotation";

animPeriod=2;

selection="rt outerwing";

axis="rt wing axis";

angle0=0;

angle1=1.55;};

class LtGear

{type="rotation";

animPeriod=2;

selection="lt gear";

axis="axis gear lt";

angle0=0;

angle1=-1.55;};

class RtGear

{type="rotation";

animPeriod=2;

selection="rt gear";

axis="axis gear rt";

angle0=0;

angle1=-1.55;};

class NoseGear

{type="rotation";

animPeriod=2;

selection="nose gear";

axis="axis gear nose";

angle0=0;

angle1=-2.2;};};

class EventHandlers

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

foldwing = "if (_this Select 1) then {(_this Select 0) Animate [""Ltouterwing"", 0]; (_this Select 0) Animate [""Rtouterwing"", 0]} else {(_this Select 0) Animate [""Ltouterwing"", 1]; (_this Select 0) Animate [""Rtouterwing"", 1]}";

};

<span id='postcolor'>

But I can't seem to get the Wings to fold. Is there a step I've missed?

DragoFire

Share this post


Link to post
Share on other sites

foldwing? Theres only "killed", "hit", "engine", "getin", "getout", "fired", "incomingmissile", "dammaged", "fuel" and "init" events as far as I know...

Share this post


Link to post
Share on other sites

wow.gif7--></span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Kegetys @ Dec. 06 2002,20wow.gif7)</td></tr><tr><td id="QUOTE">foldwing? Theres only "killed", "hit", "engine", "getin", "getout", "fired", "incomingmissile", "dammaged", "fuel" and "init" events as far as I know...<span id='postcolor'>

I've followed  "Sefe"'s guide to animate landing-gear, to get the Landing-gear to do what I want.

But I can't seem to figure-out the "foldwing" event. Which is to fold the wings up when on the ground when parked or taxi'ing onto the runway.

I hope someone can help.

DragoFire

PS.

Does anyone know how the A-10's airbrakes were done?

Share this post


Link to post
Share on other sites

The only way to do that as far as I know is by calling a script.

I have automated the ai Sea King gear so that when the chopper is under a certain height and under a certain speed the gear goes up. go above that height or speed the gear comes down. It will work with wings too.

Share this post


Link to post
Share on other sites

Coming back to your inherent question on the blinking lights of the ah-1.

Let the event handler of your choice (see Kegetys list from above) invoke the setObjectTexture statement, to toggle the textures (e.g. by a script), to simulate blinking lights. On how to use setObjectTexture procedure is posted on this forum recently under the theme of retexturing, by Suma.

For night effects, do use the correct vertices lighntning (e.g. shining). In the ofpec forum a jpg is placed at your post, to show the effect on behalf of the template craft (maybe I will extend the recent template on this).

Share this post


Link to post
Share on other sites

I've not understand so much about the blinking light, but it's not created adding the "poskozeni" point in memory lod?

Share this post


Link to post
Share on other sites

The blinking damage light has to be created in the pilot view by making a verticle and name it "poskozeni"

Share this post


Link to post
Share on other sites

Since I don't really wanna start a new topic, and the name of the topic is eventHandlers (even if it isn't actually about them):

In the command reference it says to look in "scripting topics" for more info on eventHandlers...

Where are these "scripting topics"? 'cause I really need to know the parameters that each event passes on (when it calls a script...) so if someone knows where is it ("scripting topics"), or knows where I can find a list of the parameters, could they post a link...

Share this post


Link to post
Share on other sites
Guest BratZ

I am on the topic of eventhandlers...I only have flawless sucsess using the gear tutorial and replacing the gear event.

I messed with init and getin but obviously I have syntax errors.They work but I get a DX error upon starting OFP.Anyone else get this?

Any examples of condtions? They seem to used differently.

Share this post


Link to post
Share on other sites
Guest BratZ

Anyone know how I can change this to make it available for only the gunner position?

condition="this animationPhase ""rcanopya"" < 0.03 and player in this ";

And like any chance I can change this one to like only if the engine is running? Or anything better

condition="this animationPhase ""foldwings"" < 0.5 and player in this ";

I havent had to run a seperate script yet ,I've kept everything in the config

the condition statement appears to only accept few conditions?

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 (BratZ @ Jan. 09 2003,04:33)</td></tr><tr><td id="QUOTE">Anyone know how I can change this to make it available for only the gunner position?

condition="this animationPhase ""rcanopya"" < 0.03 and player in this ";

And like any chance I can change this one to like only if the engine is running? Or anything better

condition="this animationPhase ""foldwings"" < 0.5 and player in this ";

I havent had to run a seperate script yet ,I've kept everything in the config

the condition statement appears to only accept few conditions?<span id='postcolor'>

only in gunner position: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">condition={(this animationPhase "rcanopya" < 0.03) and  (gunner this == player)};

<span id='postcolor'>

only when engine running: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">condition={(this animationPhase "foldwings" < 0.5) and (player in this) and (isEngineOn this)};<span id='postcolor'>

except that for the isEngineOn one, you may as well use the engine eventhandler...

Um, I haven't used "isEngineOn" before but if it conforms to the way most OFP functions run the syntax should be right...

EDIT: I haven't really looked at .cpp coding much yet though, so I haven't used eventHandler much yet...so I have no idea if these will work...

Share this post


Link to post
Share on other sites
Guest BratZ

Great thank you very much,knowing the syntax helps better now

And will reduce the action menu for the pilot,not having the rear canopy action

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  

×