Jump to content
Sign in to follow this  
snYpir

Getting your addon to work in ecp

Recommended Posts

Hi all.

A few of us have got together at OFPEC and built the ECP (Enhanced Configuration Project):

http://www.ofpec.com/editors/ecfg/index.php

There have been a few problems with custom addons not working, and this is because of the way that the EventHandler class is handled by subclasses.

If you define a new class with an eventhandler, say MyBoat, as follows:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class MyBoat : Ship

{

class EventHandlers

{

fired="hint {bang!}";

}

}

And then you define a subclass, with some other eventhandler:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class MyBoat2 : MyBoat

{

class EventHandlers

{

hit="hint {ouch!}";

}

}

The initial fired eventhandler will not be inherited by the subclass (it is replaced with the new definition).

Now the ECP defines an eventhandlers superclass called ECP_EventHandlers. To get your addon to work with ECP events you will have to do this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class ECP_EventHandlers {};

class cfgVehicles

{

class MyBoat : Ship

{

class EventHandlers : ECP_EventHandlers

{

fired="hint {bang!}";

}

}

}

Now my question is this: would addon makers mind supporting ECP in this fashion? The addon will work without or without the ECP being present, and all ECP effects would work on the addon in question (except for those that launch with the fired EH, in the case of our boat here for example).

Thoughts?

Note that this will work from version 1.04, the current version 1.03.

Share this post


Link to post
Share on other sites

I would like to support this, but I actually don't know which features that would be since I didn't download ECP yet (I think it was too large for me, 56k sad_o.gif ) but for sure I will do that later

would you mind to give me a short overview which features would be called by this Eventhandlers, only very generally?

I know "read the other thread" but it's very long, how many pages, 12?  crazy_o.gif

Maybe PM me  smile_o.gif

Hardrock

Share this post


Link to post
Share on other sites
Guest

Where does the top class lie?

Quote[/b] ]class ECP_EventHandlers {};

It is before the cfgVehicles start....so I'm assuming it's an entry in cfgModels......maybe?

Share this post


Link to post
Share on other sites

You can create your own eventhandler class? You are a genius , that means it wouldn't be overwriting the eventhandler for each cfgvehicles

And to answer the question as to where it goes is:

Yes still in cfgvehicles like you add the eventhandlers

Share this post


Link to post
Share on other sites

Bascially, if your addon doesn't use any eventhandlers, the following effects will be automatically enabled:

[*] Blood

[*] Explosion effects

[*] Burning vehicles

[*] Bullet whizzes

[*] Anti-tank weapon backblast

And a bunch of other stuff...

That link above has the full listing, and more are added all the time.

If your addon defines it's own EH, then none of the above will be availble unless you do:

class EventHandlers : ECP_EventHandlers

{

etc.

You would put in 'class ECP_EventHanders {};' just before the 'class CfgVehicles' line in your config.cpp. Ie it doesn't go inside any other class.

And then you'd put 'class EventHandlers : ECP_EventHandlers' actually in your vehicle class definition.

Share this post


Link to post
Share on other sites
Anything about animations?

We will be adding new animations, all in good time biggrin_o.gif

Share this post


Link to post
Share on other sites

I can't see anything wrong with the way you described it, snYpir.

It doesn't affect addons in any way, it's only a single line, in fact, why would any1 refuse? smile_o.gif

Gotta pass the info to our cpp guys so that new and updated addons will include this.

Thanks for the tip.

BTW, is there any other general info like this permitting more "sharing" and standardization amongst addons?

Ho! And is it possible to suscribes ideas to ECP? Just ideas, or implementations if done, or whatever could help you.

Share this post


Link to post
Share on other sites

As per the ECP page, we are fully open source.

The 'how to build your own mod with the ECP as a backbone' tutorial is still to come.

We welcome ideas, scripts, and even critics ;D

We are all about trying to push the game to its maximum potential, so please email me if you have ideas. Suggestions as to how to implement ideas would also be very welcome biggrin_o.gif

Share this post


Link to post
Share on other sites

hum........i would see if i could make the guys who is working on the PLA addons to make it ECP, anyway will wait till the final release version is out.......

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  

×