Jump to content

Recommended Posts

Posted

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

Posted
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)

  • Like 1

i5-9600K@4.8GHz 32Gb DDR4 rtx5070ti Quest Pro Warthog on Virpil base

Posted
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...