Jump to content
Sign in to follow this  
Solus

Extended eventhandlers

Recommended Posts

Latest version: 1.7 @ Mar. 16 2008

Extended Event Handlers (XEH) by Solus and Killswitch

Combines Extended Init, Fired, and other event handlers into a single addon. Thanks to Killswitch for combining them and adding the ability to use extended event handlers for all events! Includes working signature and key. The cfgPatch names are backwards compatible with addons made for the Extended Init and Fired EH addons. The previous addons should be removed, but shouldn't have any problems if present.

Downloads:

XEH Version 1.7:

Extended EventHandlers 1.7 @ ArmedAssault.info

Extended EventHandlers 1.7 @ Armaholic.com

Extended EventHandlers 1.7 @ ofp-zeus.com

Change log:

1.7

Fixed: Removed XEH from class Static, which stops ArmA from crashing to desktop

when resuming saved games.

1.6

Fixed: The "exclude" property will apply to the specified class(es) and all

subclasses thereof.

1.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.

1.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!

Version 1.3

Added: The ability to use "nested" XEH classes with a "scope" feature

to limit certain event handlers to objects of specific classes.

1.2

Fixed: SightAdjustment_AutoInit.

Fixed: Extended Dammaged EventHandler.

1.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.

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.

Other Extended Event Handlers by Killswitch

Adds extended event handlers for all events.

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 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.

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.

More can be read at the previous thread:

http://www.flashpoint1985.com/cgi-bin....89;st=0

Thanks to Mr Groch for testing!

Thanks to ofp-zeus.com, Armaholic.com, AssaultMissionStudio.de, Combat-Prison.net, and ArmedAssault.info for hosting!

License: XEH can be included in other releases either as the original archive or as the extracted files, preferably with the readme to help explain things. Modified versions can be released to add features or fix bugs or compatibility issues, but it should be signed and should retain backwards compatibility. Killswitch handles the SLX_XEH key and can check the code and sign new versions, although a new key can be used if necessary.

Share this post


Link to post
Share on other sites

Aha, a final event handling solution smile_o.gif thanks very much to all involved.

So this works right off the bat, no changes needed to any existing addons right?

Share this post


Link to post
Share on other sites

I'm not an addon maker but I am aware of the benefit this addon is to the community. Good work Solus & Killswitch.

Share this post


Link to post
Share on other sites

@Solus, a quick note. The examples include config.cpp files that still state

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> requiredAddons[] = {"Extended_Init_EventHandlers","Extended_Fired_EventHandlers"};

I changed that to just "Extended_EventHandlers" in my config.cpp which works fine.

Cheers,

VictorFarbau

Share this post


Link to post
Share on other sites

will there be conflict if i put this PBO along with the version 1.26 ? many addons require to have the anterior version in their requiredaddons line

Share this post


Link to post
Share on other sites

@william1 - I guess you should not keep the old versions. XEH also defines the required classes so "old" addons should work. At least it worked in a quick test for me (VFAI requiring "Extended_Init_Eventhandlers" still worked fine). It's apparently more a cosmetic matter in the examples of XEH.

Cheers,

VictorFarbau

Share this post


Link to post
Share on other sites

Yes, from my tests it works fine with addons that require Extended_Init_Eventhandlers and Extended_Fired_Eventhandlers. Thanks Solus for including backwards compatibility.

Share this post


Link to post
Share on other sites

A final version, great!

I was a bit confused by all the eventhandler addons with different names/etc.

Thanks!

MfG Lee smile_o.gif

Share this post


Link to post
Share on other sites

Sincere thanks to Solus and especially Killswitch to sort that one out.

Top notch stuff! notworthy.gif

Share this post


Link to post
Share on other sites
Warning Message: Script Extended_Init_EventHandlers\Init.sqf not found
seems like some addon(s) got issue vs backward compatibility

guess this should fix it (it was one from Examples )

from examples SightAdjustment_AutoInit.pbo\config.cpp

init="[_this select 0,""Extended_Init_EventHandlers""] execVM ""\Extended_Init_EventHandlers\Init.sqf""";

to

init="[_this select 0,""Extended_Init_EventHandlers""] execVM ""\Extended_EventHandlers\Init.sqf""";

Edited by W0lle

Share this post


Link to post
Share on other sites

After d/loading this I removed v1.26 and replaced with this version but it results in the error Dwarden posted constantly after every mission load/unload.

Warning Message: Script Extended_Init_EventHandlers\Init.sqf not found

However by replacing the v1.26 files the error no longer occurs, which I can only assume has something to do with what VictorFarbau posted...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> requiredAddons[] = {"Extended_Init_EventHandlers","Extended_Fired_EventHandlers"};

I'm happy just to leave these additional files in my addons folder if it fixes this error but if they're meant to have been superseded I'd prefer to be able to get rid of them.

Share this post


Link to post
Share on other sites

i'm unable to download from filefront ... constant

Quote[/b] ]There was an error processing your request; it appears to be invalid or there was an error with your conection. Please wait while your request is retried...

or file key error or else ...

in past 3 months FileFront service turned to be absolutely useless (it's getting worse and worse)

can someone host it on different mirror ? File Factory ? Media Fire ? whatever else smile_o.gif

Share this post


Link to post
Share on other sites

Hm.

I can't get my RUG_DSAI addon to work with this version. When only these are loaded, the init scripts aren't run at all. When the old version is in, they work. I don't get any other errors like people have listed above, and for instance MaddMatt's Effects work like advertised, no problem. So I'm guessing there's a problem in my setup of the addon. :sad_o:

Here's the config.cpp (conspiciously similar to the example configs...):

class CfgPatches
{
class RUG_DSAI
{
units[] = {};
weapons[] = {};
requiredVersion = 1.08;
requiredAddons[] = {"CAData","CASounds", "Extended_Init_Eventhandlers"};
RUG_DSAI_WantedSide[] = {"WEST", "GUER"};
};
};

class Extended_Init_EventHandlers
{

   class Man
   {
       RUG_DSAI_InitMan ="if (leader (_this select 0) == (_this select 0)) then {[_this select 0, ""RUG_DSAI""] execVM ""\RUG_DSAI\RUG_DSAISelfInit.sqf""};";
   };
   class Car
   {
       RUG_DSAI_InitCar ="if (leader (_this select 0) == (_this select 0)) then {[_this select 0, ""RUG_DSAI""] execVM ""\RUG_DSAI\RUG_DSAISelfInit.sqf""};";
   };
   class Tank
   {
       RUG_DSAI_InitTank ="if (leader (_this select 0) == (_this select 0)) then {[_this select 0, ""RUG_DSAI""] execVM ""\RUG_DSAI\RUG_DSAISelfInit.sqf""};";
   };
   class Plane
   {
       RUG_DSAI_InitPlane ="if (leader (_this select 0) == (_this select 0)) then {[_this select 0, ""RUG_DSAI""] execVM ""\RUG_DSAI\RUG_DSAISelfInit.sqf""};";
   };
   class Helicopter
   {
       RUG_DSAI_InitHelo ="if (leader (_this select 0) == (_this select 0)) then {[_this select 0, ""RUG_DSAI""] execVM ""\RUG_DSAI\RUG_DSAISelfInit.sqf""};";
   };
   class Ship
   {
       RUG_DSAI_InitShip ="if (leader (_this select 0) == (_this select 0)) then {[_this select 0, ""RUG_DSAI""] execVM ""\RUG_DSAI\RUG_DSAISelfInit.sqf""};";
   };
   class StaticWeapon
   {
       RUG_DSAI_InitWeapon ="if (leader (_this select 0) == (_this select 0)) then {[_this select 0, ""RUG_DSAI""] execVM ""\RUG_DSAI\RUG_DSAISelfInit.sqf""};";
   };
};

#define GENERAL_SPEECH_SOUND_LEVEL db-0
#define GENERAL_SPEECH_SOUND_LEVEL2 db+5
#define GENERAL_SPEECH_SOUND_LEVEL3 db-10

class CfgSounds
{

// RUG_DSAI sounds

#include "RUG_DSAI\DSAI_BehaviourSounds.h"
#include "RUG_DSAI\DSAI_FleeingSounds.h"
#include "RUG_DSAI\DSAI_WoundedSounds.h"
#include "RUG_DSAI\DSAI_OwnKilledSounds.h"
#include "RUG_DSAI\DSAI_EnemyKilledSounds.h"
#include "RUG_DSAI\DSAI_MiscSounds.h"
#include "RUG_DSAI\DSAI_GenericSounds.h"
#include "RUG_DSAI\DSAI_ContactSounds.h"
#include "RUG_DSAI\DSAI_UnderFireSounds.h"

};

Any help much appreciated :smile_o:

Regards,

Wolfrug

Edited by W0lle

Share this post


Link to post
Share on other sites

i tried to get DSAI working. after a long time of addons sorting , i tested -openal in start parameter. and now, it works.

i don't know more... biggrin_o.gif

edit: na, forget, i have the old EH too. whistle.gif

Share this post


Link to post
Share on other sites

tried ?

..
requiredAddons[] = {"CAData","CASounds", "Extended_EventHandlers"};
RUG_DSAI_WantedSide[] = {"WEST", "GUER"};
};
};

class Extended_EventHandlers {};
class Extended_Init_EventHandlers
{
...

?

Edited by W0lle

Share this post


Link to post
Share on other sites

The problem seems to be as following:

The init eventhandlers are ran earlier than before. Therefor at the moment of running (_this select 0) equals something like 0: No group.

1 second later, the object is fully initialized and everything is normal.

This means you will have to make it like:

RUG_DSAI_InitMan ="[_this select 0, ""RUG_DSAI""] execVM ""\RUG_DSAI\RUG_DSAISelfInit.sqf""";

then in RUG_DSAISelfInit.sqf

make sure there's a sleep 1;

and then a:

if (leader (_this select 0) != (_this select 0)) exitWith {};

I'll send you a fixed version aswell as a multiplayer compatible version (where the server decides what is being said so it's synchronised on all clients, normal operations happen when playing Single Player)

Edited by W0lle

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  

×