PDA

View Full Version : Assign Event Handler to vehicles



SNKMAN
Jun 2 2009, 00:53
Hey guy's,

just tryed to add the "Init", "Fired" and "Killed" Event Handler to vehicles in my "Config.cpp"
The class "Man" always works with each E.H. Type, i just can't assign them to "LandVehicles" and "Air" vehicles.

May a bug?

My Config.cpp


class CfgPatches
{
class GL3
{
units[] = {};
weapons[] = {};
requiredVersion = 1.0;
requiredAddons[] = {"CAData"};
};
};

// ////////////////////////////////////////////////////////////////////////////
// GL3 v.1.4 Event Handler Initialize Preprocess
#define GL3_Preprocess "if (isNil ""GL3_Path"") then {GL3_Path = ""\@<hidden>\AddOns\GL3_Core\""; call compile preprocessFile (GL3_Path+""GL3_Preprocess.sqf""); _this spawn (GL3_Compile select 0) } else { _this spawn (GL3_Compile select 0) }";
// ////////////////////////////////////////////////////////////////////////////

class DefaultEventhandlers;

class CfgVehicles
{
class AllVehicles;

class Land;

class Man : Land
{
class EventHandlers : DefaultEventhandlers
{
init = GL3_Preprocess

fired = "_this call (GL3_EH_Fired_F select 0)";
hit = "_this call (GL3_EH_Hit_F select 0)";
killed = "_this call (GL3_EH_Killed_F select 0)";
};
};

class LandVehicle : Land
{
class EventHandlers : DefaultEventhandlers
{
init = GL3_Preprocess

fired = "_this call (GL3_EH_Fired_F select 0)";
hit = "_this call (GL3_EH_Hit_F select 0)";
killed = "_this call (GL3_EH_Killed_F select 0)";
};
};

class Air : AllVehicles
{
class EventHandlers: DefaultEventhandlers
{
init = GL3_Preprocess

fired = "_this call (GL3_EH_Fired_F select 0)";
hit = "_this call (GL3_EH_Hit_F select 0)";
killed = "_this call (GL3_EH_Killed_F select 0)";
};
};

class Ship : AllVehicles
{
class EventHandlers : DefaultEventhandlers
{
init = GL3_Preprocess

fired = "_this call (GL3_EH_Fired_F select 0)";
hit = "_this call (GL3_EH_Hit_F select 0)";
killed = "_this call (GL3_EH_Killed_F select 0)";
};
};
};

Maddmatt
Jun 2 2009, 02:51
Because they are being overwritten by the default eventhandlers.

Adding tracked, wheeled, ect to the "requiredaddons" field would make your eventhandlers overwrite them instead. But then you disable the BIS eventhandlers and the smokescreens wont work as well as some other effects. Look at the default eventhandlers (in the config in ca.pbo I think) and make sure to add those.

There should be an extended eventhandlers addon eventually. Until then the eventhandlers are going to be messy I think.