MadTommy Posted February 18, 2011 Posted February 18, 2011 (edited) I should know this or be able to work it out, considering how much i use triggers & flags, but i'm having a brain fart. Example: I want a message to play every 10 minutes as long as a flag is true (set) I know some long winded ways of doing this with 'time since flag' triggers, but it requires a trigger for every time i want the message to be played. How do i simply make a trigger loop. I think i'm missing something simple. My daft long winded way! (not showing the kill switch) Once > Unit in zone > Set Flag 1 Once > Flag 1 true > Message to Blue, Set Flag 10 Once > Time since Flag 10 (600) > Message to Blue, Set Flag 11 Once > Time since Flag 11 (600) > Message to Blue, Set Flag 12 Once > Time since Flag 12 (600) > Message to Blue, Set Flag 13 Once > Time since Flag 13 (600) > Message to Blue, Set Flag 14 etc etc :doh: (edit: this is in the wrong section, sry) Edited February 18, 2011 by MadTommy i5-3570K @ 4.5 Ghz, Asus P8Z77-V, 8 GB DDR3, 1.5GB GTX 480 (EVGA, superclocked), SSD, 2 x 1680x1050, x-fi extreme music. TM Warthog, Saitek combat pro pedals, TrackIR 4
MadTommy Posted February 18, 2011 Author Posted February 18, 2011 hmm would this work? Once > Unit in zone > Set Flag 1 Once > Flag 1 true > Message to Blue, Set Flag 10 Continuous > Time since Flag 10 (600) > Message to Blue, Set Flag 10 i5-3570K @ 4.5 Ghz, Asus P8Z77-V, 8 GB DDR3, 1.5GB GTX 480 (EVGA, superclocked), SSD, 2 x 1680x1050, x-fi extreme music. TM Warthog, Saitek combat pro pedals, TrackIR 4
Grimes Posted February 18, 2011 Posted February 18, 2011 hmm would this work? Once (Loop Start)> Time More 10 seconds (or whatever)>Set Flag 1 Switched Condition> Time since flag 1 (598)> Clear Flag 1, Set Flag 2 Switched Condition> Time Since Flag 2 (1)> Set Flag 1 ,Clear Flag 2 Switched Condition> Flag 2 is True > Message 1 Or you can have multiple versions of the same message... Switched Condition> Flag 2 is True AND Flag 31 is True> Message =" Friendly convoy is enroute to waypoint 2" Switched Condition> Flag 2 is True AND Flag 32 is True> Message =" Friendly convoy is enroute to waypoint 3" Switched Condition> Flag 2 is True AND Flag 33 is True> Message =" Friendly convoy is enroute to waypoint 4" I think the method you posted works, however I typically don't use "continous" so I'm not 100% how it works with everything. 1 The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
MadTommy Posted February 18, 2011 Author Posted February 18, 2011 Thanks mate, I've never been sure about "Switched Condition", just haven't got my head around that. I also don't like using "continous" as i just imagine it to be very resource intensive. I generally just use Mission Start & Once. I need to undersatnd "Switched Condition". i5-3570K @ 4.5 Ghz, Asus P8Z77-V, 8 GB DDR3, 1.5GB GTX 480 (EVGA, superclocked), SSD, 2 x 1680x1050, x-fi extreme music. TM Warthog, Saitek combat pro pedals, TrackIR 4
Grimes Posted February 18, 2011 Posted February 18, 2011 Think of "switched condition" as "A repeating 'once'". It is basically the same thing, it just has the capability to be used more than once. They are only executed if the conditions were previously false. Lets say you have a Trigger > Unit in Zone> Message. The unit being tested has waypoints that drive inside and outside of the zone constantly. So once it enters the zone it turns around to exit the zone, and once outside it turns around to enter as a repeating cycle. When its set as "Once" it will simply display the message once the unit gets inside the zone the first time. As a Switched Condition it will display the message every time the unit enters the zone after exiting. Set as continuous it will keep repeating the message as long as the unit is in the zone. The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
Speed Posted February 18, 2011 Posted February 18, 2011 My method: Once(kick start loop)-> Time more (1) -> Set Flag(loop flag) Switched(start loop) -> Flag is false(1) -> Set Flag(1) Switched(restart loop) -> Time since flag(1, loop_time) -> Clear Flag (1) You can also do things to try to make the code more robust. Sometimes, things that should work don't because the game misses something. Here's a more robust method: Once(kick start loop)-> Time more (1) -> Set Flag(loop flag) Switched(start loop) -> Time since Flag(2, 2) -> Set Flag(1), Clear Flag(2) Switched(restart loop) -> Time since flag(1, loop_time) -> Clear Flag (1), Set Flag 2 Now the game has a whole two seconds to "realize" that Flag 1 is false and to reset the "time since" counter for it. If you look through my missions, you'll often notice me making "redundent" conditions and actions in my triggers. I clear flags and that sort of stuff when they already SHOULD be clear. DON'T TAKE ANYTHING FOR GRANTED. For example, if you have some sort of message loop with radio options, anticipate that the user might interrupt it any time with extraneous flag settings... So alot of the times, it's just a good idea to clear flags in actions when they already should be cleared, or set them when they should already be set- as long as you aren't depending on a "time since" for that flag. I believe that setting a flag true that is already true will restart the "time since" counter. Anyway... just my 2 cents. Intelligent discourse can only begin with the honest admission of your own fallibility. Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/ Lua scripts and mods: MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616 Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979 Now includes remote server administration tools for kicking, banning, loading missions, etc.
MadTommy Posted February 18, 2011 Author Posted February 18, 2011 Thanks.. from both your inputs i've found an even simpler way that works. Just two triggers. Once (start loop) > any condition > Message, Set Flag 1 Switched Condition > Time since flag 1 (x) > Message, Set Flag 1 Message is repeated every x seconds :) i5-3570K @ 4.5 Ghz, Asus P8Z77-V, 8 GB DDR3, 1.5GB GTX 480 (EVGA, superclocked), SSD, 2 x 1680x1050, x-fi extreme music. TM Warthog, Saitek combat pro pedals, TrackIR 4
Speed Posted February 18, 2011 Posted February 18, 2011 Thanks.. from both your inputs i've found an even simpler way that works. Just two triggers. Message is repeated every x seconds :) Yea, it should, since setting a flag will reset its counter. But.... I don't depend on that myself. It's worth the extra triggers to me if it makes it more robust. I've seen actions and triggers fail to work in many missions, mine and others (yours in fact Tommy, in Operation Cherkesh, after killing the road block group, the game never seems to advance to the next trigger)... donno why. It just seems worth it to me to make things ridiculously robost when triggers take so little processing time to evaluate. Intelligent discourse can only begin with the honest admission of your own fallibility. Member of the Virtual Tactical Air Group: http://vtacticalairgroup.com/ Lua scripts and mods: MIssion Scripting Tools (Mist): http://forums.eagle.ru/showthread.php?t=98616 Slmod version 7.0 for DCS: World: http://forums.eagle.ru/showthread.php?t=80979 Now includes remote server administration tools for kicking, banning, loading missions, etc.
MadTommy Posted February 18, 2011 Author Posted February 18, 2011 Yea, it should, since setting a flag will reset its counter. But.... I don't depend on that myself. It's worth the extra triggers to me if it makes it more robust. I've seen actions and triggers fail to work in many missions, mine and others (yours in fact Tommy, in Operation Cherkesh, after killing the road block group, the game never seems to advance to the next trigger)... donno why. It just seems worth it to me to make things ridiculously robost when triggers take so little processing time to evaluate. Understood. That problem on my mission with the road block was actually an error on an early version and has since been corrected. I did test the above system with no issues. But i'll keep an eye on it. i5-3570K @ 4.5 Ghz, Asus P8Z77-V, 8 GB DDR3, 1.5GB GTX 480 (EVGA, superclocked), SSD, 2 x 1680x1050, x-fi extreme music. TM Warthog, Saitek combat pro pedals, TrackIR 4
Recommended Posts