![Random AP Weather Triggers (script) Random AP Weather Triggers (script)](https://alanthomsonsim.com/wp-content/uploads/edd/2019/05/jpg/ozdazz/RandomAPWeatherTriggers-1140x641.jpg)
Random AP Weather Triggers (script)
12th May 2019This is a ScenarioScript.lua file to be used with the Armstrong Powerhouse Sky & Weather Enhancement Pack.
It extends the existing triggers by:
– allowing them to be triggered at a random time
– allowing them possibly to not trigger at all (based on probability)
– allowing them to be selected randomly (for variety)
Use of this script may be ideal if you create and play your own scenarios. Or if you have your own ‘go to’ scenario which you run regularly (eg to test new rolling stock) – creating a bit of random weather will give it some variety.
A rtf (rich text format) readme file has been included with information on the triggers and their use (including examples)
Simply extract all files (it will create its own folder containing the script and documentation) and copy the ScenarioScript.lua file into the folder of the new scenario you have created. You will need to read the manual to get an idea on how the four types of triggers work together.
Please contact me should you encounter any bugs, need help, wish to provide feedback or discuss this further.
These scripts only work with AP Sky and Weather EP version 1. If you have AP Sky & Weather EP Version 2, then you don’t need this script (the AP version does it much better).
Thank you for the feedback, Francois, and for reporting this issue. I have not used the scripts in awhile so wasn’t aware of any problems. When creating this, I had to try a few different ways to get a true random seed, as most just seemed to give the same seed pattern each time, which defeated the purpose. I’m glad you’ve been able to find a way to get it working 🙂
Thank you for this work, which brings a missing link in AP’s original package !
I found however that the os.clock() call, used to generate a seed for the random generator, is faulty on my system (triggers an error which defeats the entire script). It’s a fairly common setup (Windows 10 2004), so I assume it must always be defective. Maybe DTG changed something in the way lua handles the ‘os’ library…
Anyway, I made a few tests removing the init function (which means : no call to math.randomseed()) and I found out that the randomness seems perfectly fine for this non-critical use 😉