Detected-By Type of trigger that works as you expect - Printable Version +- Comrades in Arms Discussion Board (http://forum.ciahome.net) +-- Forum: Comrades in Arms Life (http://forum.ciahome.net/forumdisplay.php?fid=3) +--- Forum: Mission Making (http://forum.ciahome.net/forumdisplay.php?fid=8) +--- Thread: Detected-By Type of trigger that works as you expect (/showthread.php?tid=3610) |
Detected-By Type of trigger that works as you expect - Alwarren - 07-04-2017 I found a post by Killzone Kid that detailed a way to work around the problem of AI detection triggers, and I extended this to be able to work with multiplayer. Here's the theory: You have a Detected-By-Trigger with a countdown. You EXPECT that if the players kill all the detecting units before the timeout hits, it would not trigger, but we all know how this turns out. Now, here's a way to achieve this (most; it has a few caveats). What this does is, it creates a trigger that triggers if and only if any unit that has spotted the players is alive at the end of the timeout. Here's how it works (this assumes player faction is independent or blufor): Place a trigger and make it repeatable, but instead of making it "BLUFOR Detected By OPFOR" make it "OPFOR" and "present". Delete the "this" condition and replace it with: [playableUnits, thisList] call FHQ_fnc_detectedBy Set the trigger activation field to whatever you need, and set the trigger to TIMEOUT with whatever timeout you want. That's it. The magic comes with the FHQ_fnc_detectedBy. If you use a function module, you can put the following code in a function. Otherwise, add it to a variable in the mission's init.sqf: Code: FHQ_fnc_detectedBy = { // remove this line if you put it into a function module The detectedBy function just goes through all the OPFOR units in the trigger and counts their knowledge about the player, if they are alive (dead units do not reset their knowsAbout so this is important). If the result is not 0, then there is at least one unit alive that has detected the players. Since this condition needs to be satisfied over the entire time of the timeout, if the players manage to kill all units with knowsAbout > 0, the trigger will not fire. Caveats:
Enjoy! |