OFPEC Forum
Addons & Mods Depot => OFP - Addons & Mods General => Topic started by: Triggerhappy on 24 Dec 2004, 04:14:09
-
what exactly is the syntax for eventhandlers in the config (i searched the forums to almost 2 years back and it didn't help)
what i want is a fired EH
-
The events available in OFP and in your EventHandler definintion are
- init
- dammaged (yes, misspelled with two 'm':s)
- engine
- fired
- fuel
- gear
- getin
- getout
- hit
- incomingMissile
- killed
Example using just four of them:
...
...
class MyVehicle {
...
...
...
class EventHandlers
{
init = "string with init code goes here";
hit = "code for hit EH";
fired = "fired code";
killed = "aargh";
};
...
...
};
...
...
-
Inside the cfgVehicle class:
...
class eventHandlers
{
fired = " ...";
};what exactly do you need ?
The 'fired' EH returns a five elements array: the first (_this select 0) is
the shooter, the last (_this select 4) is the ammo type being fired,
the other elements are the weapon being fired and its muzzle modes.
This array can obviously be used inside the EH itself, that is:
fired = "if ((_this select 4) == ""psy_mcar_dummyTow"") then {deleteVehicle (nearestObject [_this select 0, _this select 4]); ...};";this delete the bullet fired by the shooter if this happens to be "psy_mcar_dummyTow" type. Note the use of double quotes: they
are compulsory, otherwise OFP will return an error.
-
I'm makin a flashbang, so there is no cfg vehicles
-
nevermind, i just realized that won't work