Jump to content
Sign in to follow this  
Militant1006

Firing Detection

Recommended Posts

Hello guys just wondering what do you put in a trigger if you want a few soldiers to get detected if they start firing?

eg. I have Spec Ops riding in a civilian car wearing civilian clothes (thanks McNools!) and i have put setCaptive true in their init. boxes, and have put a trigger outside the targets compund with setCaptive False for all the operatives, but i need to find something i can put in a trigger that sets them to setCaptive false if they fire their gun.

Thanks for any help Militantsausage

Share this post


Link to post
Share on other sites

Been working on this with a fellow mission maker for a mission for our squad, our best bet seems to be the uhh Infantry stealth and recon set; basically if you use it to set a unit's visual and audible stealth to 100%, then they will only be 'spotted' when they fire

http://forums.bistudio.com/showthread.php?t=95484

Share this post


Link to post
Share on other sites

not quite what i'm looking for, as i said i have used setCaptive, which means that even if i am spotted, they will not fire, i need a trigger that detects if they fire and then if it returns true or whatever then it will set them as setCaptive false.

Share this post


Link to post
Share on other sites

Try to use the FiredNear event handler, note that it will detect weapons fire within 69 Meters max, if you want to detect it further away, then you have to use the Fired event handler.

Add this event to the captive unit, the EH shall looks like that.

FNEH = myunit addEventHandler["FiredNear",{...}];

... is the code that you wish to execute whenever a weapon is fired near the unit, in your case it would be mostly something like:

... = myunit setCaptive false; myunit removeEventHandler FNEH;

Share this post


Link to post
Share on other sites

Here's a demo mission. Try driving out of the compound; shooting someone; having your AI shoot someone; having an AI walk out of the compound.

Three triggers are needed.

First trigger covers the compound, Anybody Present Repeatedly, named compound.

Condition:

{vehicle _x in thislist} count units uct < count units uct

No onAct needed.

Second trigger, no size or settings.

Condition:

triggerActivated compound

OnAct:

{_x setCaptive false;} forEach units uct;

Third trigger just assigns the eventHandlers, this could do in an init or init.sqf or wherever really.

Condition:

true

onAct:

{_x addEventHandler ["fired", "{_x setCaptive false;} forEach units uct;"]} forEach units uct; 

That's what checks if any of your guys fired and drops their captive state if they do.

Edited by kylania

Share this post


Link to post
Share on other sites

thank you very much guys, by the way, what do you do if you want multiple targets in a trigger in the condition box? eg. i tried !alive tank1; !alive car1; !alive gun1 but it didn't work, any ideas?

EDIT:

I think i've solved the problem, you just put and in between each !alive unit intead of ;

Edited by Militantsausage

Share this post


Link to post
Share on other sites
thank you very much guys, by the way, what do you do if you want multiple targets in a trigger in the condition box? eg. i tried !alive tank1; !alive car1; !alive gun1

Don't use ; in the condition field, just:

!alive tank1 && !alive car1 && !alive gun1

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  

×