Hi!
Me as an "Schönbau" creator i like when a line has a huge of variations of trains, many kinds of trains pass through.
Previously, i solved this by creating one train storage station:
My problem was with this solution that the game had to simulate too much trains. This had an effect on performance. And the trains came continuously (not randomly).
So I created a mode for my save game that can replace the trains randomly from an array, on the selected stations.
I use my script with my save game with about 50 lines and the arrays have more than 100 vehicles.
I made an simple save game to show how it works.
-It read the train arrays.
-Checks the trains and their last stops in the update function.
-If a train has departed from the "replacer" station, then the train got the id of next stop as "stopIndex".
-The program will realise it and replace the train for another one from the correct array.
More details in the: random_train_generator.lua
-- Attention!!!!!!!!!!!!
-- This mod works with only one save game! You have to copy it as a new one to reuse it for another save!
-- If you want to delete a train or a line than you must delete first must it here and then in the game!
-- The mod can be disabled in any time!
-- Some modded vehicles does not work with this version. But most of them works correctly!
-- If you have a dump than you can see the last replaced vehicle in the stdout.txt (Line name, array index, train id).
-- If a vehicle cause a dump then you have to delete the line from the array (array index)!
I am not a professional mod creator. I am a programmer for the business sector. I created it as a hobby.
It's not a complete mod. It's an alpha version concept without error handling.
It can be more dynamic and better.
I just let it here. Maybe it's a good example for future mods.