B

bcool

Member

Last active 8 years ago

  1. 8 years ago
    Thu Sep 17 22:32:30 2015
    B bcool posted in Vehicle Custom Init.

    Alright, thanks, I thought it was with ALiVE :)

  2. Thu Sep 17 22:29:04 2015
    B bcool posted in Vehicle Custom Init.

    OPFOR - CSAT, just the default to test the script

  3. Thu Sep 17 22:24:45 2015
    B bcool posted in Vehicle Custom Init.
     
    8:16:58 "[INS] UNIT TYPE = any"
     8:16:58 "[INS] Adding init to MAN"

    Tested with empty helicopter and AI controlled helicopter, all found men are still counted, vehicles aren't still

  4. Thu Sep 17 22:05:20 2015
    B bcool posted in Vehicle Custom Init.

    It's not even printing the unitType for vehicles in onKilled.sqf

  5. Thu Sep 17 21:52:05 2015
    B bcool started the conversation Vehicle Custom Init.

    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?

  6. Thu Sep 17 21:44:23 2015
    B bcool joined the forum.