0ps 10 Posted September 12, 2013 (edited) I need to activate a trigger as soon as ANY unit has fired a weapon without a suppressor. I have found posts on gun fire but not specific types of fire. Appreciate any help. Edited September 12, 2013 by 0ps Share this post Link to post Share on other sites
kylania 568 Posted September 12, 2013 Fired eventhandler checking for suppressor in wiki/primaryWeaponItems. Share this post Link to post Share on other sites
0ps 10 Posted September 12, 2013 I had a look but it's a bit beyond me at the moment. I was hoping for some example code. Share this post Link to post Share on other sites
kylania 568 Posted September 12, 2013 TAG_fnc_suppressorCheck = { private ["_suppressor"]; _weaponFired = _this select 1; _weaponItems = weaponsItems player; _suppressor = false; { if ((_weaponFired == _x select 0) && !((_x select 1) == "")) then { _suppressor = true; }; } forEach _weaponItems; /* if (_suppressor) then { player sideChat "Yes, I had a silencer"; } else { player sideChat "No, I didn't"; }; */ _suppressor }; player addEventHandler["fired", {if (_this call TAG_fnc_suppressorCheck) then {player sideChat "Suppressed!"}}]; Share this post Link to post Share on other sites
0ps 10 Posted September 12, 2013 Thanks, I got it working now. The messages in chat is a nice little way to test it, however sidechat command doesn't seem to be working, I used hint instead for testing. How would I check a list of unit names instead of "player"? Share this post Link to post Share on other sites
kylania 568 Posted September 12, 2013 You'd run the event handler on the units you care about since that's the easiest way to tell when someone had fired. Share this post Link to post Share on other sites