davidoss 552 Posted September 25, 2015 Hi. I need help with this setup because its just will not working for me like supposed. I have add event handler on all civilian units in mission with : class Civilian_F { init = "(_this select 0) call INS_fnc_ckcivEH"; }; func INS_fnc_ckcivEH : // INS_fnc_ckcivEH if ((vehicleVarName _this) == "ins_suicide") exitWith {}; if (_this isKindOf "Man") then { _this addEventHandler ["killed", { private ["_cvictim", "_ckiller"]; _cvictim = _this select 0; _ckiller = _this select 1; if(vehicle _ckiller isEqualTo vehicle _cvictim ) exitWith{}; if (isPlayer _ckiller) then { [] remoteExec [ "INS_fnc_ckMP", _ckiller ]; }; }]; }; I want to not execute the code when _this is unit created from script : _posSuicide = [minarete_1, minarete_2, minarete_3, minarete_4, minarete_5, minarete_6, minarete_7] call BIS_fnc_selectRandom; _suicideGrp = createGroup CIVILIAN; _suicide = _suicideGrp createUnit ["LOP_Tak_Civ_Man_01", [(getpos _posSuicide select 0), (getpos _posSuicide select 1), 0], [], 100, "NONE"]; _suicide setVehicleVarName "ins_suicide"; ins_suicide = _suicide; publicVariable "ins_suicide"; In function INS_fnc_ckcivEH line 2 i wrote: if ((vehicleVarName _this) == "ins_suicide") exitWith {}; Why it is not working? Why the suicide guy gets eventhandler? Share this post Link to post Share on other sites
jshock 513 Posted September 25, 2015 Have you checked the output of "vehicleVarName _this"? 1 Share this post Link to post Share on other sites
davidoss 552 Posted September 25, 2015 Good shot. hint "adding adeventhandler to " + str (vehicleVarName _this); gives me adding adeventhandler to Why? How to exclude this guy from addeventhandler? Share this post Link to post Share on other sites
jshock 513 Posted September 25, 2015 What does _this show as its arguments coming into the function? I assume "(_this select 0)" in the init attribute in the Civilian class is the actual unit, I've never actually done anything from the Civilian class before so just checking. Share this post Link to post Share on other sites