Kovah85 10 Posted March 1, 2010 (edited) Maybe someone could help me out here, I can't seem to make this work: {if (isnil (_x getVariable "handled")) then { _x setVariable ["handled", 1, true]; _x addEventHandler ["killed", "[_this select 0, _this select 1]execVM 'killed.sqf'"]; }} forEach allUnits; No errors or anything... just doesn't... do... anything. Even adding an ELSE doesn't do anything. EDIT: Take note, this is just a snippet that I hastily edited to make readable on the forum. Edited March 1, 2010 by Kovah85 Share this post Link to post Share on other sites
[aps]gnat 28 Posted March 1, 2010 Wrong subforum - Try: ArmA 2 - MISSION EDITING & SCRIPTING Share this post Link to post Share on other sites
Kovah85 10 Posted March 1, 2010 Oh crap. I meant to post there. Sorry. Share this post Link to post Share on other sites
IndeedPete 1038 Posted March 1, 2010 (edited) Try this: { if (isnil (_x getVariable "handled")) then { { _x setVariable ["handled", 1, true]; _x addEventHandler ["killed", "{[_this select 0, _this select 1] execVM "killed.sqf"}]; } forEach allUnits; }; } forEach allUnits; Edited March 1, 2010 by IndeedPete Share this post Link to post Share on other sites
Reimann 10 Posted March 1, 2010 {_x addEventHandler ["killed", []execVM 'killed.sqf']; } forEach allUnits; Share this post Link to post Share on other sites
TRexian 0 Posted March 1, 2010 I had a similar issue with the isnil check on a getvariable, but decided it was because isnil wants a variable in quotes. I worked it out to something like this: { _dummy = _x getVariable "handled"; if (isnil "_dummy") then { { _x setVariable ["handled", 1, true]; _x addEventHandler ["killed", "{[_this select 0, _this select 1] execVM "killed.sqf"}]; } forEach allUnits; }; } forEach allUnits; But, I think Reimann may have the real answer. ;) Share this post Link to post Share on other sites
Big Dawg KS 6 Posted March 1, 2010 _x addEventHandler ["killed",{[_this select 0, _this select 1] execVM "killed.sqf"}]; This is not OFP, code should be contained within { }'s not quotes. Also you don't really need to have all those parameters, just pass _this to the script even if all you need are just the first 2 arguments. _x addEventHandler ["killed",{_this execVM "killed.sqf"}]; Share this post Link to post Share on other sites