apolloace Posted April 13, 2017 Posted April 13, 2017 Question - Suppose, I have 4 flags which are set to FALSE. I want to choose randomly, to set any 2 of them to TRUE. What are the lua functions or scripts available to perform this task? :helpsmilie: Rig - I7-9700K/GIGABYTE Z390D/RTX-2080 SUPER/32-GB CORSAIR VENGEANCE RAM/1-TB SSD Mods - A10C / F18C / AV8B / Mig21 / Su33 / SC / F14B
sea2sky Posted April 13, 2017 Posted April 13, 2017 Question - Suppose, I have 4 flags which are set to FALSE. I want to choose randomly, to set any 2 of them to TRUE. What are the lua functions or scripts available to perform this task? :helpsmilie: if you know their names and keep them in the table you can arrange a function that will withdraw 2 of them randomly local flagName = flagNames[math.rand(1, #flagNames)] local flag = trigger.misc.getUserFlag(flagName) 1 i5-9600K@4.8GHz ★ 32Gb DDR4 ★ rtx5070ti ★ Quest Pro ★ Warthog on Virpil base
apolloace Posted April 15, 2017 Author Posted April 15, 2017 if you know their names and keep them in the table you can arrange a function that will withdraw 2 of them randomly local flagName = flagNames[math.rand(1, #flagNames)] local flag = trigger.misc.getUserFlag(flagName) Hi ruskybeaver, I had to tweak the code a little bit, to make it work. local flagName = flagNames[mist.random(#flagNames)] mist.scheduleFunction(trigger.action.setUserFlag, {flagName, true}, timer.getTime() + 1) I had kept the flags inside the table flagNames and then used a condition loop to get the desired flags set to TRUE. Thanks a lot for your help. :) Rig - I7-9700K/GIGABYTE Z390D/RTX-2080 SUPER/32-GB CORSAIR VENGEANCE RAM/1-TB SSD Mods - A10C / F18C / AV8B / Mig21 / Su33 / SC / F14B
sea2sky Posted April 17, 2017 Posted April 17, 2017 :thumbup: i5-9600K@4.8GHz ★ 32Gb DDR4 ★ rtx5070ti ★ Quest Pro ★ Warthog on Virpil base
Recommended Posts