Chief Instructor Posted May 9, 2022 Share Posted May 9, 2022 Hi, I want a condition to be true at a random time between 1 - 4 minutes. I can't find a straight forward way of doing this! I've tried cycling a randomised flag until the flag value hits a certain value, but it's so hit and miss and I want to be able to stipulate the time range more exactly. Can anyone help?! Many thanks CPU: Intel i9 13900KS @5.8GHz | MB: ROG Strix Z790 Gaming-E | GPU: Asus ROG Strix RTX3090 OC | RAM: 32Gb Corsair Dominator DDR5 @6200MHz | Cooling: Custom CPU/GPU cooling loop | PSU: Supernova 850G2 @ 850W | OS: Windows 10 Home Premium 64Bit Storage: 3x Samsung EVO 970 Plus M.2 1Tb + 3x Samsung 850 EVO SSD 250Gb | Input: TM HOTAS WH Saitek Combat Pedals | Output: Samsung 50" OLED TV | VR: HP Reverb G2 | Audio: Realtek + Z906 5.1 Surround Sound Speaker System Link to comment Share on other sites More sharing options...
toutenglisse Posted May 10, 2022 Share Posted May 10, 2022 3 hours ago, Chief Instructor said: Hi, I want a condition to be true at a random time between 1 - 4 minutes. I can't find a straight forward way of doing this!... Hi, you can use this script in a "Do Script" box, it will activate flag 'timer' at a random time between 60 and 240 seconds (.miz attached) : Spoiler function SetFlag(Vars) trigger.action.setUserFlag(Vars[1], Vars[2]) end local Delay = math.random(60, 240) timer.scheduleFunction(SetFlag, {'timer', 1}, timer.getTime() + Delay) test-timer-60-to-240s.miz 1 Link to comment Share on other sites More sharing options...
Chief Instructor Posted May 10, 2022 Author Share Posted May 10, 2022 19 hours ago, toutenglisse said: Hi, you can use this script in a "Do Script" box, it will activate flag 'timer' at a random time between 60 and 240 seconds (.miz attached) : Hide contents function SetFlag(Vars) trigger.action.setUserFlag(Vars[1], Vars[2]) end local Delay = math.random(60, 240) timer.scheduleFunction(SetFlag, {'timer', 1}, timer.getTime() + Delay) test-timer-60-to-240s.miz 6.6 kB · 3 downloads @toutenglisse Thanks very much I think I even understand how works! CPU: Intel i9 13900KS @5.8GHz | MB: ROG Strix Z790 Gaming-E | GPU: Asus ROG Strix RTX3090 OC | RAM: 32Gb Corsair Dominator DDR5 @6200MHz | Cooling: Custom CPU/GPU cooling loop | PSU: Supernova 850G2 @ 850W | OS: Windows 10 Home Premium 64Bit Storage: 3x Samsung EVO 970 Plus M.2 1Tb + 3x Samsung 850 EVO SSD 250Gb | Input: TM HOTAS WH Saitek Combat Pedals | Output: Samsung 50" OLED TV | VR: HP Reverb G2 | Audio: Realtek + Z906 5.1 Surround Sound Speaker System Link to comment Share on other sites More sharing options...
Recommended Posts