Comrades in Arms Discussion Board

Full Version: Fired eventhandler - trying to keep stealth in the mission
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi code gurus

I'm trying to set an eventhandler "fired' in place to fail the mission in the event that players engage hostiles before they have been given the all clear. Not sure exactly how to code it.

thanks in advance

Lighty

note: I should have 3 missions ready for testing in the next week on Lingor if you're interested to beta test them for me.
I am not quite sure what you mean with "how to code it". Event handlers are added via addEventHandler, which you probably already know. But you cannot just fail a mission based on that because the effect is local.

The thing you could do is

{
_x addEventHandler ["Fired", {
  ["failEnd", false] remoteExec ["BIS_fnc_endMission"];
}];
} foreach playableUnits;

Needs a proper description.ext entry for failEnd obviously, and it will end the mission a bit abruptly.
thanx I will consider it further, I don't really want an abrupt fail.
(01-23-2016, 12:58 AM)Lightspeed link Wrote: [ -> ]thanx I will consider it further, I don't really want an abrupt fail.

you might want to try putting a sleep in front of it, but I am not sure whether an event handler is run in a scheduled environment - my guess would be it isn't, so sleep would not work. You could also just spawn some code that sleeps.
Interested to know the logic behind ending a mission when you open fire... why would the mission end? (because any know you are there? or someone was alerted etc...)... just in case there may be another way around thats less abrupt
Good question, but pretty simple really and could apply in many situations.

In this scenario, a cocaine shipment is being delivered by boat and once unloaded may be relocated quickly. So the assault team needs to get into position to seize the cargo but must not be discovered until then because alarm will be sounded and ship will abort the drop. A weapon fired is probably the most obvious result of one being detected, or if one of the players lacks discipline and engages the enemy then mission fails.

I could also imagine a target being alerted to enemy presence by the sound of gunfire and bugging out. In the same way, the Ghost team would have to remain undetected until in a position to eliminate the target.

I have decided to instead go with a trigger, whereby, if any members of the patrols are killed then a minute or so later an alarm will sound and mission will fail with message "Enemy has been alerted to your presence". Unless there is a better suggestion because silenced weapons should be a legitimate way to kill without giving away ones presence. Although on reflection, if enemy patrols were checking in every 5 minutes and suddenly didn't that could cause panic and ship abort.

That makes sense now.


There is a "Detected" setting on a trigger, so if Blufor are detected by Opfor, but that could be too hard... as it almost seems like the enemy see you but are unsure (which will fail the mission), if you get back into cover after a min or two you are not detected any more.


How about, once the enemy open fire, that way you can sneak in, kill a patrol with a silencer, enemy may hear something and be suspicious, or they may even be enemy standing next to the guy that got shot, but in a panic, they are too busy finding cover and looking for you that they havent called it in, so kill him before he shoots back.  That way until they open fire, you can carry on sneaking.


Also, if this is a night time mission, I can copy over some script to remove enemy NV goggles and give them flash lights... makes sneaking more interesting

I always wanted to make a proper stealth handling since I like stealth. I was thinking of once their knowsAbout go over a certain threshold, have a stealth meter like pop up (like Splinter Cell stealth meter) let you know that they're freaking out to the point of calling an alarm, so you got to kill the guy (and if you did, drop the stealth meter back to highest knowsAbout level). Say if knowsAbout = 3 (alarm level that you set), got to kill them in X seconds before alarm goes. If knows about greater than 0 but below 3, stealth meter "Yellow" as in, they're a bit suspicious but not, but after a while it goes back to 0 "Green". That was something I had in mind on how to handle stealth whenever I get back to stealth missions since I do love them... but you know... real life obligations.... Also, maybe I should learn some Arma GUI. I made one as an attempt (some sort of health bar) before though not dedicated compatible.


As for silencer, I found a thread somewhere for eventHandler to see whether you shoot and have a silencer on or not. Add an eventhandler to each enemy AI if they shoot, pretty much auto alarm. If you shoot, do a check to see whether you have a silencer on or not.


I think post #4 by kylania have suppressor check (might want to modify the word player for something else since "player" isn't good for dedicated servers) https://forums.bistudio.com/topic/154489...uppressed/