T.A. Posted October 23, 2024 Posted October 23, 2024 Hello, i have question about mission editor, triggers and flags etc. 1- I want to play a sound file (Im defending), if SAM shoots me a missile. I did it with (missile in triggers zone) and as action (Sound at coalition). Here i have no problem. 2- But if SAM shoots me again within 120 seconds after the first shot, i want to play another sound (Im defending again!) and check for next 120 seconds too, if the third missile comes to me. If yes then then plays second sound (Im defending again), like a loop! 3- But if after the second or third shot, no SAM shoots at me for 180 seconds, the sound must go back to first sound (Im defending), if any SAM shoots me . I know to use (missile in trigger zone) or (flag on). But i dont know how to add a timer to that first shot as condition for second or third shot in the next120 seconds after first shot and make it a loop. After 180 seconds stop the loop and set the program to play that first sound (Im defending) again, like first shot from SAM. I need somehow a timer to check the condition 1 for certain time and play the second Action, if its true. After that run the second action as long as it happens within 120 seconds like a Loop. If the time out of 120 seconds, it must back to first condition and first action. I appreciate any idea and thanks in advance
Solution nighteyes2017 Posted October 24, 2024 Solution Posted October 24, 2024 (edited) well, i thought this was a bit of a fun challenge to figure this out. It seems i got it working. It would be a bit difficult to explain it al in text only, so i included a mission file to go with it. Here goes: First of all, you need to discern 2 different things: if the missile fire is the first, or a second or third missile. So when the first missile fires, you detect a missile, and you set a "Missile Active" Flag to on, and you also test that flag to be OFF on that very same trigger. If that flag is off, it is the first missile. --- Then. You need to clone that exact trigger again, but this time, check for that "Missile Active" Flag to be ON. If it is true, then this is not the first missile. Now Set the Missile Active" Flag to on again, even if it is already on. Now. on this second missile detection, you set another flag to true, name this a "Multi Missile Active" Flag You need to check this flag as well to be off on the first detection trigger. --- Every time a flag is set to on, while it is already on, that trigger will restart the count. (you could also build a trigger to manually set it to off, and then immediatley set it to on again after 1 second) Now build a trigger that sets the "Missile Active" Flag to off after 120s (time since flag). Build another trigger that sets the ""Multi Missile Active" Flag to off after 180s (time since flag). --- As for the detection zone, make it small. why? Well, the above works in theory, but needs one more thing. If a missile is launched, and the flag comes on, it wil immediately trigger the second detection rule also, since the only difference in the detection triggers is that "Missile Active" Flag. So we need to build an inhibit flag. A flag that comes on with any missile launch, but then sets a flag for 10 secs and then turns off. that flag needs to be off in order for any of the 2 missile detection triggers to be valid. Those 10 seconds is what the missile needs to leave the small detection zone. So when the inhibit switches off, there is no missile to detect in the zone anymore, and the zones are ready for the next detection. Lastly, i build in a missile launch simulator. Which means you can use the radio F10 menu to trigger a simulated missile launch. That is why you will find the 'OR' statements in the detection triggers. also, i set the timers different for easy testing. 30 sec instead of 120, and 60 secs instead of 180. You can easily adjust those off course. Text messages included in the operations. Hope this helps. Missile loops.miz Missile loops with missile simulation.miz Edited October 24, 2024 by nighteyes2017
T.A. Posted October 29, 2024 Author Posted October 29, 2024 Hello, I tested your files. But the first file (Missile loops.miz) works better for me. You see. It works only with scripts, which i could'nt solve. Thanks for your help.
Recommended Posts