DM_LOOP=true; // Loop enabled, can be disabled in mid-mission by making the boolean false DM_LOOP_TIME=30; // Loop time, how many seconds between checks for new units on the map DM_trig = createTrigger ["EmptyDetector",getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition")]; DM_trig setTriggerType "NONE"; DM_trig setTriggerActivation ["ANY", "PRESENT", true]; DM_trig setTriggerArea [30000, 30000, 0, false ]; DM_trig setTriggerStatements ["this", "", ""]; DM_EH_KILLED= { // CODE TO EXECUTE WHEN UNIT KILLED, _this is filled with Killed EH _this }; [] spawn { private ["_DM_KE"]; _DM_KE= { _this setVariable ["DM_SIGNATURE", true]; _this addEventHandler ["killed",{_this spawn DM_EH_KILLED}]; }; while{DM_LOOP}do { // Run through all the units that are catched (and refreshed) by DM_trig { // Check if signature is present, if present move on to the next unit if(isNull (_x getVariable "DM_SIGNATURE"))then { // Catch only Vehicles(+Infantry etc etc), not logics etc if(_x isKindOf "AllVehicles")then { if(_x isKindOf "Man")then { // Run the Function on the unit _x call _DM_KE; }else{ // Run the Function on the units inside vehicle { _x call _DM_KE } forEach (crew _x); }; }else{ // When not part of all vehicles, set signature so it doesn't get re-evaluated again _x setVariable ["DM_SIGNATURE", false]; }; }; } forEach (list DM_trig); sleep DM_LOOP_TIME; }; };