Extended eventhandlers (xeh)
by
Solus & Killswitch
Description:
This addon allows a virtually infinite amount of 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
for custom units.
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.
Extended fired event handler:
This allows a virtually infinite amount of fired event handlers to be used
together from different addons.
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 called Extended_EventHandlers so that all 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.
It 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.
Installation:
Extract the pbo(s) in your Arma/addons folder or as we always recommend use a modfolder.
If you do not know how to use mod folders have a loom in our FAQ.
Included files:
Extended_Eventhandlers.pbo
Change log:
v1.93
Changed:
Empty vehicles created after the mission started did not get their
InitPost handlers called.
v1.92
Changed:
Some optimizations made (eg use pre-compiled XEH init functions).
v1.91 (private release together with the ACE mod)
Added:
New "post-init" feature that can be used to have a script run once at the end of mission initialisation, after all init EH:s and mission init lines have executed, but before the mission's init.{sqs,sqf} is processed.
Added:
There's also a per-unit, "InitPost" XEH framework which lets you run scripts at the end of mission init. Unlike the PostInit event handlers described above, these snippets run once for every unit in the mission. (The name of this framework may change in the future to avoid confusion with "PostInit")
v1.9
Added:
stringtable with STR_SLX_XEH_VERSION for use with the localize command.
Fixed:
crew and cargo of manned vehicles have their XEH init event handlers called earlier, just before the mission starts.
Addon makers can create a Extended_PreInit_EventHandlers class with code that will run once, before any XEH init EH processing takes place.
v1.8
Fixed:
game logics inside vehicles would cause a performance drop due to an infinite recursion in the code that handles initialisation of vehicle crews.
Added:
you can make XEH init event handlers execute when players respawn by using an inner XEH class and the "onRespawn" boolean property.
v1.7
Fixed: Removed XEH from class Static, which stops ArmA from crashing to desktop
when resuming saved games.
v1.6
Fixed: The "exclude" property will apply to the specified class(es) and all
subclasses thereof.
v1.5
Added: Composite ("inner") XEH classes can have an extra property, "exclude"
which is either a string or an array of strings with the class name(s)
of vehicles that should *not* get a particular XEH event handler.
v1.4
Added: "Static" class vehicles can now have XEH event handlers.
Added: A respawn monitor that restores non-init XEH event handlers after the player respawns. Many thanks to Sickboy, LoyalGuard and ViperMaul for the initial research and suggestions!
v1.3
- Added: The ability to use "nested" XEH classes with a "scope" feature
to limit certain event handlers to objects of specific classes.
v1.1
- Fixed: XEH can now handle extended event handlers that are missing a trailing semicolon.
- Fixed: the example addons now require the Extended_Eventhandlers addon instead of the two older ones. Also, the debug sideChats are now guaranteed to be seen when previewing a mission with the example addons loaded.
- Fixed: XEH init EH:s are now actually being called on units inside vehicles.
v1.0
- Initial Release
- Combined Extended Init, Fired, and Other event handlers. Thanks to Killswitch for combining them and adding the other extended event handlers!
Added signature and bikey.
v1.2
- Added signature file.
- Fixed a bug that caused crashes on some missions. Thanks to LCD344!
- Changed ExecVM to Call Compile. Thanks to UNN!
v1.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.