description.ext
class Extended_Init_EventHandlers { //All class All { init = "_this call (compile preprocessFileLineNumbers 'events\onKilled.sqf');"; }; };
events\onKilled.sqf
private "_unit"; _unit = _this select 0; if ((side _unit == east) and (!isPlayer _unit)) then { _unitType = typeOf _unit; diag_log format ["[INS] UNIT TYPE = %1", _unitType]; if (_unitType isKindOf "Man") then { diag_log "[INS] Adding init to MAN"; [_unit] execVM "events\man_killed.sqf"; }; if (_unitType isKindOf "Car") then { diag_log "[INS] Adding init to CAR"; [_unit] execVM "events\car_killed.sqf"; }; if (_unitType isKindOf "Truck") then { diag_log "[INS] Adding init to TRUCK"; [_unit] execVM "events\car_killed.sqf"; }; if (_unitType isKindOf "Tank") then { diag_log "[INS] Adding init to TANK"; [_unit] execVM "events\tank_killed.sqf"; }; if (_unitType isKindOf "Helicopter") then { diag_log "[INS] Adding init to HELO"; [_unit] execVM "events\helicopter_killed.sqf"; }; };
events\car_killed.sqf (example, they all look like this)
private "_unit"; _unit = _this select 0; _unit addEventHandler ["Killed", { private["_unit", "_killer", "_unitFac", "_killerFac"]; _unit = _this select 0; _killer = _this select 1; _unitFac = side (group _victim); _killerFac = side (group _killer); _killMoney = 1500; _killer globalChat "Killed enemy car +$1500 to Operation Budget!"; B_defensebudget = (B_defensebudget + _killMoney); publicVariable "B_defensebudget"; }];
The above code works for all enemy man units; but it refuses to work on any vehicles.
Is there anything I'm doing wrong?