Norm49 1 Posted December 20, 2022 Hi I'm trying to create a event handler the will fire every time the player kill a unit. The script to execute is simple it will only be a = 1. The variable a is to be call in trigger that is currently working as intended. What i try doesn't work. I create a init.sqf file and put this in it. _x addEventHandler ["Killed", { [_this select 0, _this select 1]if (isPlayer _killer) then a = 1; } foreach allunits; Form all my try and research during the last 4 hours that the best i came with and it still doesn't work. Thanks for any assistance with this. Share this post Link to post Share on other sites
RCA3 581 Posted December 21, 2022 Hello, Unfortunately your syntax is wrong, check wiki: https://community.bistudio.com/wiki/forEach https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Killed It's better to use the params given in the examples on the wiki. Keeps things simple and clear for everyone. In order to use the variable _killer you need to pass it down first through params. Variable a is too vague as well as it can be easily overwritten and you should make it more explicit. { _x addEventHandler ["Killed", { params ["_unit", "_killer", "_instigator", "_useEffects"]; if (isPlayer _killer) then{a = 1}; }]; }foreach allunits; 1 Share this post Link to post Share on other sites
Norm49 1 Posted December 21, 2022 The variable "a" was use just temporally for debugging any ways it now work as intended thanks! 1 Share this post Link to post Share on other sites
fn_Quiksilver 1633 Posted December 21, 2022 // init.sqf if (hasInterface) then { addMissionEventHandler [ 'EntityKilled', { params ['_killed','_killer']; if (_killer isequalto player) then { }; } ]; }; Share this post Link to post Share on other sites