tn_prvteye Posted October 17, 2017 Share Posted October 17, 2017 I need to set up triggers so that a random LUA script is run from a choice of four, and ONLY one is run. I got this from the Hoggit site (and yes this for a group, but I'm assuming I can do the same for script activation): Single Choice from List Once > Random 5% AND Flag 1 is False > Activate Group 1 AND Set Flag 1 True Once > Random 5% AND Flag 1 is False > Activate Group 2 AND Set Flag 1 True Once > Random 5% AND Flag 1 is False > Activate Group n AND Set Flag 1 True Am I understanding correctly that there's a 5% chance the 1st Group will be activated, then 5% for the next and so on...until one is chosen down the list and sets the flag to true (this stopping any further activation)? Now, since it's set up as "Once", there's a 95% chance nothing will happen each time. So since my list is rather short (only four scripts), there's a good chance that nothing will be run? Is there a way to make sure at least ONE is activated randomly and that's it? I hope I'm making sense, I'm still new to triggers and mission building. Link to comment Share on other sites More sharing options...
tn_prvteye Posted October 18, 2017 Author Share Posted October 18, 2017 Okay, I think I've got an answer that works. If I use "Continuous Action" instead of "Once" it works the way I want. Are there any issues with having this run the entire mission? Performance problems? It still seems like a messy way to do it. Link to comment Share on other sites More sharing options...
Looney Posted October 18, 2017 Share Posted October 18, 2017 Either that or increase your chance of something spawning, like 50% instead of 5? [sIGPIC][/sIGPIC] Commodore 64 | MOS6510 | VIC-II | SID6581 | DD 1541 | KCS Power Cartridge | 64Kb | 32Kb external | Arcade Turbo Link to comment Share on other sites More sharing options...
tn_prvteye Posted October 18, 2017 Author Share Posted October 18, 2017 I considered that, but in that case there's a higher chance that the first scripts listed will be chosen first. I think. Math is hard. Anyway, I think this'll work. I'll let the mission play out for awhile and see what happens. Link to comment Share on other sites More sharing options...
feefifofum Posted October 18, 2017 Share Posted October 18, 2017 If you end up with a ton of continuous action triggers it can take a bite out of the host machine's processing power, but with just a couple you should have no issues. THE GEORGIAN WAR - OFFICIAL F-15C DLC Link to comment Share on other sites More sharing options...
tn_prvteye Posted October 18, 2017 Author Share Posted October 18, 2017 Yeah, there's only four triggers, and it's just me running it as an SP mission. I can't really release it to the public as it's quite a jumble of several other user's scripts crammed together to do what I want. And it's very, VERY messy. :D Link to comment Share on other sites More sharing options...
FlightControl Posted October 19, 2017 Share Posted October 19, 2017 Yeah, there's only four triggers, and it's just me running it as an SP mission. :D tn_prnteye, An open question, can you code? I mean, you have programming experience? There are alternatives when it gets complicated. FC [TABLE][sIGPIC][/sIGPIC]| Join MOOSE community on: DISCORD :thumbup: Website of the MOOSE LUA Framework. MOOSE framework Downloads. Check out Example Missions to try out and learn. MOOSE YouTube Channel for live demonstrations and tutorials. [/TABLE] Link to comment Share on other sites More sharing options...
tn_prvteye Posted October 19, 2017 Author Share Posted October 19, 2017 Unfortunately, I cannot. I know enough to copy-pasta OTHER people's code, but that's about it. :D Thanks for looking, though. I think my messy way works fine enough for me. Link to comment Share on other sites More sharing options...
Recommended Posts