Jump to content
Sign in to follow this  
dinger

1.85 config.cpp changes

Recommended Posts

I raised the issue in a related thread over in the editing forum, but it's really an addon question, and I'd really like to have the answer to it.

1.85 added eventhandlers accessible via scripting or the config file.

Via scripting it's clear how eventhandlers work -- and they all work, except for events "Init" and "Dammaged". (Of course, scripting in-game for the event "Init" is redundant -- that's what the init field is for.)

And the comref addresses that.

But what about config.cpp event handlers? How do you add them in? What is the syntax?

We've got some cool addons that are ready to go, but just waiting on this last piece of the puzzle.

Share this post


Link to post
Share on other sites
Guest BratZ

New Comref has been released , including 1.85 changes and a few examples.

Share this post


Link to post
Share on other sites

Here is config.cpp that uses Incoming missile and gears events - "Advanced A10":

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

{

class A10Advanced

{

units[] = {A10Advanced};

weapons[] = {};

requiredVersion = 1.82;

};

};

class CfgVehicles

{

class A10 {};

class A10Advanced: A10

{

displayName="A10 (Advanced)";

class EventHandlers

{

incomingMissile = "((_this select 0)==vehicle player) if {(_this select 0) say ""A10WarningSound""}";

gear = "((_this select 0)==vehicle player and (_this select 1)) if {(_this select 0) say ""A10GearLockSound""}";

};

};

};

class CfgSounds

{

class A10WarningSound

{

sound[]={Objects\alarm_loop1,db-10,1.5};

name = "A10WarningSound";

titles[] = {};

};

class A10GearLockSound

{

sound[]={Objects\door,db-15,1.5};

name = "A10WarningSound";

titles[] = {};

};

};

<span id='postcolor'>

Share this post


Link to post
Share on other sites

Shouldn't this

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

incomingMissile = "((_this select 0)==vehicle player) if {(_this select 0) say ""A10WarningSound""}";

gear = "((_this select 0)==vehicle player and (_this select 1)) if {(_this select 0) say ""A10GearLockSound""}";

<span id='postcolor'>

be

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

incomingMissile = "if ((_this select 0)==vehicle player) then {(_this select 0) say ""A10WarningSound""}";

gear = "if ((_this select 0)==vehicle player and (_this select 1)) then {(_this select 0) say ""A10GearLockSound""}";

<span id='postcolor'>

instead? wink.gif

Share this post


Link to post
Share on other sites

good to know, thnx suma.

Other q: If I use a eventhandler like "init" in the config of an unit, is it possible to pass the name of that unit to another script.

Something like:

Init = "[this] exec "example.sqs""

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 (Kegetys @ Oct. 16 2002,18:59)</td></tr><tr><td id="QUOTE">Shouldn't this if (cond) {code} be if (cond) then{code} instead? wink.gif<span id='postcolor'>

You are right (as usual). The example was created in the early days of if command, and syntax changed since then. Thank you for the correction.

Share this post


Link to post
Share on other sites

It's nice, really nice, and will let us do some wonderful things.

But is there a way to make Init events run on all clients, and not just locally?

Dinger

(back to polling)

Share this post


Link to post
Share on other sites

Is there any chance that there will be *updated* versions of existing OFP standard units with those new features added?

It would be really great to have incoming sounds, etc.. not only for addons but the original models as well.

Share this post


Link to post
Share on other sites

I agree with Nyles, that would just be awesome... Just make it for the su and the a-10. no need to make any AI change, since that would probably screw up some earlier missions - but it would be a really cool eyecandy thingy for us players smile.gif ´

And keggies.... redo that Hawk of yours biggrin.gif

//Edit - Or you could just give us that A-10 advanced for us to play with smile.gif Some of us are too lazy or too stupid to depo the plane ourself.... So couold it be made an official addon?

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  

×