Jump to content
Sign in to follow this  
0ps

Activate trigger when player has fired with certain weapon types (unsuppressed)

Recommended Posts

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 by 0ps

Share this post


Link to post
Share on other sites

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
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

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×