Jump to content
Sign in to follow this  
Solus

Extended Init Event Handler

Recommended Posts

Update: 12-29-07 Extended Init EventHandlers Version 1.26 released

This addon allows a virtually infinite amount of init event handlers to be used together from different addons. The event handlers are executed for the matching class and all inheriting classes. The event handler init line also contains the extended event handler class to look for, so you can have a custom inheritance class for different units. There are two example addons included to demonstrate how to assign new event handlers and the event handler inheritance. The example pbos should not be installed except for testing.

Normally event handlers can only be added in configs, and trying to add a new event handler caused all previous event handlers to be overwritten, this addon allows that limitation to be overcome. This is mostly useful for having addons that can add different functionality, for example in OFP addons that had their own event handlers wouldn't inherit default event handlers, such as a custom unit with EHs being used with ECP or FFUR wouldn't have the ECP or FFUR effects. Or for example in ArmA the sight adjustment addon could be used with other event handler addons, such as the upcoming Group Link 3 and SLX Wounds.

Extended Init EventHandlers Version 1.26

Changes:

Version 1.26:

Fixed signature files and addons and added bikey.

Version 1.2:

Changed the ExecVM to call compile, thanks to UNN.

Added LCD's fix, thanks for finding that!

Added signature files.

Version 1.1:

Fixed people in vehicles having no inits.

Included SightAdjustment example "bridge" addon that allows the GMJ_SightAdjustment addon to be used with other extended init event handler addons.

Also included is Extended Fired EventHandlers 1.0:

Readme:

This addon allows a virtually infinite amount of fired event handlers to be used together from different addons. The Extended Init Event Handlers addon must be installed to use this addon.

The extended fired event handler has several different parts:

First the extended init EH is run for all units to add together and compile all of the inherited fired event handlers and use setVariable to attach those to the unit.

The extended fired event handler is added to the base class Extended_EventHandlers so that all of the cfgVehicles class EventHandlers inherit it. When a unit fires and sets off the event handler the shot is immediately captured in the same game state cycle. Then the compiled extended fired events are called by using getVariable to retrieve them from the unit.

The fired event handler init line contains the extended event handler class to look for, so you can have a custom inheritance for custom units. The event handlers are executed for the matching class and all inheriting classes.

There is an example addon included to demonstrate how to assign new fired event handlers and the event handler inheritance. The example also has a quickly called function that is able to capture information on the shot in the same game state cycle before the shot is updated and moves away from it's starting position and changes it's status. The example pbo should not be installed except for testing.

Download:

Version 1.26:

Extended Init Event Handler v1.26 @ Combat-Prison.net

Extended_Init_EH_1.26.rar @ FileFront.com

Version 1.2:

Extended Init EventHandlers 1.2 @ Armaholic.com

Extended Init EventHandlers 1.2 @ ArmedAssault.Info

Extended Init EventHandlers 1.2 @ Combat-Prison.net

Extended Init EH 1.2 @ FileFront.com

Thanks to ArmedAssault.Info, Armaholic.com, Combat-Prison.net, and Armed Assault Ukraine for hosting!

Share this post


Link to post
Share on other sites
....the upcoming Group Link 3 and SLX Wounds.....

great release thanks. and great news to look forward to! smile_o.gif

Share this post


Link to post
Share on other sites

nifty stuff - kudos to you smile_o.gif

Share this post


Link to post
Share on other sites

Fantastic. Now I can get the sight adjustment to work WITH XAM ! Well done.

Now if only I could get the full DMSmokeEffects to work (the REAL black smoke part that is only active IF I run the server) that would be sweet.

Any code that could do that ?

Kremator

Share this post


Link to post
Share on other sites

Now we need to get modders to use this. Hopefully they will.

Edit: It would be nice if it supported the other eventhandlers too, such as fired. I know you can manually add them through the init script but it wont be necessary for all addons to run an init script. It could make the start of a large mission just a little less demanding too with less init scripts.

Share this post


Link to post
Share on other sites

Yeah, hopefully it will catch on and more creative things will be made that can work with each other.

I think an extended fired EH could be better made as an additional addon, maybe the fired event can be added to the class Extended_EventHandlers so the cfgVehicles class EventHandlers will inherit both the extended init and fired event handlers. Actually it might not be preferable to have the fired EH work the same way as the init one, since all of the configs and stuff are scanned each time the EH is called, which would probably slow down the game since it's doing so much. That's why the init one isn't too big of a deal since usually it's rarely run. A fired EH would have to have the code compiled with an init and then executed by the fired EH. That might negate having less stuff in the init though, but it should only need the one extra init line in the extended fired EH addon to compile the fired EH lines so that to add new fired EHs only new fired EH lines will have to be added to the configs.

I think the addEventHandler for fired EHs is good enough for right now but there's nothing stopping someone else from making an extended fired EH addon to work with the extended init if they want to expend the effort.

Share this post


Link to post
Share on other sites
...

After having a closer look at your addon, I guess it's best the way it is. Adding the fired EH through the init seems to be easy enough. Hopefully this addon will become standard and we wont have all these mod/addon compatibility issues. They should be able to work together nicely smile_o.gif

The Extended init addon seems to work perfectly. I've already found a use for it (I'm sure some people can guess what that is wink_o.gif ).

Share this post


Link to post
Share on other sites

So am I the first modder to use this? link. biggrin_o.gif

Now we need other modders to do the same so our mods can be compatible.

I packaged it with my effects mod, made sure to include everything including the readme.

Good job on this. It should become standard with mods.

Share this post


Link to post
Share on other sites

Cool stuff Maddmatt! Your use of the fired event also reminds me of one big benefit for the extended fired event handler though, the nearestObject command would only need to be run once, then all the init compiled code would run. With the AddEventHandler way, each added event needs to run the nearestObject command, creating some unnecessary slowdown.

Share this post


Link to post
Share on other sites

This is more of a "bridge" addon that allows other addons using it to work together and hopefully other mods will use it to implement their effects so that addons can also add effects. I don't know if it works with XAM, but I hope the mod makers decide to integrate the extended Init so the Sight Adjustment and other addons can be used with their mod.

Share this post


Link to post
Share on other sites

well, a list of proven mods which support your addon would be useful.

I want to get rid to load a punch of mods in my startupparameter so i put all those addons/mods in one "@realism_collection\addons" folder...

I'm using:

CSM_sounds (chammys soundmod)

CSM_cfg

GMJ_sightadjustment (edited to match the rangecardfolder)

Matt_armaeffects

NWD_ballistics

NWD_extraballistics

NWD_RealDispersion

NWD_RocketBallistics

NWD_ScopeFix

NWD_SightAdjustmentPlugin

SIX_Blood

SIX_editorupdate

SIX_Misc

SIX_Tracers

and your:

Extended_Init_EventHandlers

SightAdjustment_AutoInit

well, that doesn't work... i guess not every mod in this list has support for your extended event handler addon and is causing trouble...

I dont want to miss just one of these mods, cause arma is only a great experience anymore with those enabled.

Share this post


Link to post
Share on other sites
...

I think my mod is the only one that uses it at the moment. The 6thsense.eu stuff might do the same in the next update, that's Sickboy's decision.

For a mod to work with this, it has to be made to use it. Any mod that uses this will require it.

Share this post


Link to post
Share on other sites
Quote[/b] ]NWD_extraballistics

I left this in my release? Eh, well. You don't need it, and it doesn't do anything in game. It's intended to be a collection of data on ammunition not used by the game, for the general use of the community. Right now it just has 9x39mm SP-5 and SP-6 ballistics, neither of which is used by anything.

Share this post


Link to post
Share on other sites

What program do i use to open these pbo files? For some reason the usual winpbo doesnt work. Tried Kegety's cpbo without any luck either banghead.gif

Thanks

Share this post


Link to post
Share on other sites

I used cpbo to make them so cpbo should work to open them. Make sure it's the ArmA cpbo and try deleting your windows file extension for .pbo and then run cpbo to reassociate it with pbo's. In windows explorer > Tools > folder options > file extensions or something.

Share this post


Link to post
Share on other sites

6thSense.eu Mod fully supports Extended Init Event Handlers.

Soon the changes will be ported to the sub products like "Pack1"...

I urge any addon maker to support Solus on this one... It's a great addon and in the end will save many many many headaches and need to edit 30 addons to make them compatible with eachother ;P

Share this post


Link to post
Share on other sites

Cool stuff sickboy!

Extended Init EventHandlers Version 1.1 released

Download:

Extended_Init_EH_1.1.rar @ FileFront

Changes:

Version 1.1:

Fixed people in vehicles having no inits.

Included SightAdjustment example "bridge" addon that allows the GMJ_SightAdjustment addon to be used with other extended init event handler addons.

Also included is Extended Fired EventHandlers 1.0:

Readme:

This addon allows a virtually infinite amount of fired event handlers to be used together from different addons. The Extended Init Event Handlers addon must be installed to use this addon.

The extended fired event handler has several different parts:

First the extended init EH is run for all units to add together and compile all of the inherited fired event handlers and use setVariable to attach those to the unit. Also the Extended_FiredEH_ShotInfo function is compiled at init, so that it can be quickly called during the fired event game state cycle to capture info about the shot, such as the position, direction, speed, etc.

The extended fired event handler is added to Extended_EventHandlers so that all of the cfgVehicles class EventHandlers inherit it. When a unit fires and sets off the event handler the shot is immediately captured in the same game state cycle and the Extended_FiredEH_ShotInfo function is run to catch the shot's info. Then the compiled extended fired events are called by using getVariable to retrieve them from the unit, but this takes until another game state cycle before the extended scripts/functions are able to run so they can't catch the shot's info before it moves away, which is why the ShotInfo function is needed.

The Extended_FiredEH_ShotInfo function can be modified to get more info about the shot but it shouldn't be changed in any way that can break addons made for previous versions by rearranging the info or something. The fired event handler init line contains the extended event handler class to look for, so you can have a custom inheritance for custom units. The event handlers are executed for the matching class and all inheriting classes.

There is an example addon included to demonstrate how to assign new fired event handlers and the event handler inheritance. The example pbo should not be installed except for testing.

Normally event handlers can only be added in configs, and trying to add a new event handler caused all previous event handlers to be overwritten, this addon allows that limitation to be overcome. This is mostly useful for having addons that can add different functionality, for example in OFP addons that had their own event handlers wouldn't inherit default event handlers, such as a custom unit with EHs being used with ECP or FFUR wouldn't have the ECP or FFUR effects.

The extended fired event handler allows more fired events to be used together, for example a script that makes shots affected by wind and a tracer script could be used together.

NOTE:

The ShotInfo function has been removed, since it's possible to run precompiled functions from the extended fired EH. You can quickly get your own data about the shot's start state using your own function defined in the init then run from the extended fired EH. However having too many of these quick data collecting functions for each EH script might slow things down so it might be better to readd the default shotinfo function to get data for most scripts to use.

It might be useful for someone to make another addon that makes the shotinfo function that's still included in the fired EH .pbo get compiled at init and run by the extended fired EH, so that other extended fired EH addons can use the data without needing their own info gathering script to run. The only problem might be the order that the extended fired EventHandlers are run in but that should be easy to figure out and fix. The included example addon has an example of a function that is compiled with the extended init event handler and called by the extended fired EH so that the shot's info can be collected and used before the shot moves away.

Share this post


Link to post
Share on other sites

Great ! I hope most common mods/addons will apply this, in order to have complete compatibility.

Malick

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×