d0ct0r0z Posted December 26, 2020 Posted December 26, 2020 Hi guys, I set up a dynamic mission where a strike aircraft attacks an airbase of opposition. When the aircraft destroys all ground targets, I have a ground unit triggered and capture the airbase. For this aircraft, I am using MOOSE Spawn command and having it spawn multiples at a certain waypoint. However, I would like to stop this respawning (continuous spawning) when the airbase is already captured. I am seeing a condition LUA predicament. I already am using flags to keep track of the airbase. If BLUE: Flag 1 = 10 If RED: Flag 1 = 5 Can I code this in the LUA predicament? If 5, I would like to add this on the LUA predicament box so it won't keep SPAWNING multiples of the same aircraft infinitely. Thank you in advance!
Nalfeyn Posted December 26, 2020 Posted December 26, 2020 If you are already using MOOSE for the spawning why not use MOOSE for the capturing too? There are a few demo missions on airbase capturing inside the MOOSE GitHub.
Chump Posted December 26, 2020 Posted December 26, 2020 (edited) if trigger.misc.getUserFlag("1") == 10 then reuturn false end return true Something like this should stop it from triggering while flag 1 equals 10. Edited December 26, 2020 by Chump 1
d0ct0r0z Posted December 26, 2020 Author Posted December 26, 2020 8 hours ago, Nalfeyn said: If you are already using MOOSE for the spawning why not use MOOSE for the capturing too? There are a few demo missions on airbase capturing inside the MOOSE GitHub. Thanks dude. I am still trying to wrap my head around using flags and triggers, so scripting is probably way out of my league at this point. I just want to build a medium scale dynamic campaign similar to that of the Hoggit servers for my friends.
d0ct0r0z Posted December 26, 2020 Author Posted December 26, 2020 (edited) 5 hours ago, Chump said: if trigger.misc.getUserFlag("1") == 10 then reuturn false end return true Something like this should stop it from triggering while flag 1 equals 10. Dude! Thank you so much!!! It worked!!!! Do you know if I can also do "and" or "or" statements? Match either conditions, or match all conditions ,etc? Sorry - another follow up question. Can I tie the spawning of airplanes based on flags? For the airplanes that no longer spawn due to a switched condition: Base is now red: Flag 1 = 5 so LUA predicament tells my airplanes to not repeatedly spawn. How about when the base goes blue again, where I mark Flag 1 = 10. How do I respawn those airplanes? I tested switched conditions for this case and it doesn't work. DCS does not trigger the spawning of an airplane based on a flag for some reason. Y'all are probably laughing at me for something that seems elementary, but coding and scripting is not really my thing. I am learning as I go. Thank you again. Edited December 26, 2020 by d0ct0r0z
Chump Posted December 27, 2020 Posted December 27, 2020 (edited) @d0ct0r0z Glad it steered you in the right direction. if [condition] and [condition] then if [condition] or [condition] then The trigger should execute when the base is no longer your own coalition (according to your flag setting). ex: when it is taken over by the enemy coalition, the strike should happen again. Edited December 27, 2020 by Chump
Recommended Posts