My train trigger keeps regenerating new trains repeatedly.Solved

My trigger keeps regenerating new trains every 30 seconds or so and it wont stop, and I have to spend all my time removing them all before it regenerates new ones, until the point where I just have to delete the trigger completely to get it to stop clogging up my entire railway with hundreds of trains. Anyone know how I can make this plugin just spawn in 3 different train setups just once each and never more?

Ive got a 13 minute train loop around my island and I want it to have 3 trains cycling through so it stops about every 4min15sec about.

Not sure which trigger is doing it but at some point when I make my 2nd or 3rd train, it just starts regenerating new trains all the time. 

My entire process from beginning to end is:

/awt.add Workcart
/awt.train Workcart WagonC WagonC Caboose Workcart
/awt.add Conductor Forward Med Right

And then I add my 6 stations:
/add.awt Brake Zero 20 Med

and then my final station which is the main station:
/add.awt Brake Zero 30 Med

And then at that point, when I calculated its 33% of the way through the track that I timed out, I create a new train to fill in the gaps so there is always a train arriving every 3-4 minutes as my total train is about 13 mins long all the way around.

So at 4min15ish after departing first train, I do:

/awt.train Workcart WagonLoot WagonFuel Caboose Workcart

which should create a new different train, and this part maybe I dont understand, because it just starts creating more and more and more trains every 30 seconds or so, without stopping.

Any info would be helpful, thanks!

Each trigger can have at most one train spawned at a time. If that train is destroyed, that trigger will spawn a new train, which can occur at most every 30 seconds. If you are seeing that a single trigger has multiple spawned trains at the same time, then either you have modified the plugin code to allow that (some servers have done that), or you have encountered a bug. I tried reproducing the issue using your steps provided above, but so far everything seems to be working normal (at most one train per trigger).

If you want multiple trains to appear on the same track but spaced out, you'll have to space out the spawners somehow. Placing the spawners so close that the trains can overlap can cause the trains to break in half. If you find yourself relying on timings derived from manually respawning the trains at set intervals, then you will inevitably encounter problems when the plugin is reloaded since it will respawn all trains at approximately the same time.

One way to space out the trains is to simply space out each spawner evenly around the map.

Another way to space out trains is to place the spawners nearby each other, off the main loop, with different delays, as depicted in the following ASCII art diagram. However, this requires separate branches to be available, which you can certainly achieve with a custom map, but branch availability may be limited on procedural maps. The reason the spawners have to be off the main loop is that the delay can only be applied to a Zero speed trigger (e.g., awt.add Workcart Conductor Zero 10 Fwd Hi for a 10 second start delay) which will cause the trains to stop on return visits which you don't want (since that could cause all trains to stop multiple times in the same area if all triggers are on the same route, or just as bad, each train would stop for a different duration causing them to eventually collide).

:          .------------
          /  Loop -> ...
         / /------------
        / /
       / /
      / /
     | |\
     | | \
     | |\ \
     | | \ \------------
     | |  \  <- Loop ...
     | |   '------------
     | |
    /| |\
   / | | \
  / /| |\ \
 / / | | \ \
| |  | |  | |
|A|  |B|  |C|
| |  | |  | |

A = 0 delay
B = 60 second delay
C = 120 second delay
NKXTQs24ExGTuL8.jpg WhiteThunder

Each trigger can have at most one train spawned at a time. If that train is destroyed, that trigger will spawn a new train, which can occur at most every 30 seconds. If you are seeing that a single trigger has multiple spawned trains at the same time, then either you have modified the plugin code to allow that (some servers have done that), or you have encountered a bug. I tried reproducing the issue using your steps provided above, but so far everything seems to be working normal (at most one train per trigger).

If you want multiple trains to appear on the same track but spaced out, you'll have to space out the spawners somehow. Placing the spawners so close that the trains can overlap can cause the trains to break in half. If you find yourself relying on timings derived from manually respawning the trains at set intervals, then you will inevitably encounter problems when the plugin is reloaded since it will respawn all trains at approximately the same time.

One way to space out the trains is to simply space out each spawner evenly around the map.

Another way to space out trains is to place the spawners nearby each other, off the main loop, with different delays, as depicted in the following ASCII art diagram. However, this requires separate branches to be available, which you can certainly achieve with a custom map, but branch availability may be limited on procedural maps. The reason the spawners have to be off the main loop is that the delay can only be applied to a Zero speed trigger (e.g., awt.add Workcart Conductor Zero 10 Fwd Hi for a 10 second start delay) which will cause the trains to stop on return visits which you don't want (since that could cause all trains to stop multiple times in the same area if all triggers are on the same route, or just as bad, each train would stop for a different duration causing them to eventually collide).

:          .------------
          /  Loop -> ...
         / /------------
        / /
       / /
      / /
     | |\
     | | \
     | |\ \
     | | \ \------------
     | |  \  <- Loop ...
     | |   '------------
     | |
    /| |\
   / | | \
  / /| |\ \
 / / | | \ \
| |  | |  | |
|A|  |B|  |C|
| |  | |  | |

A = 0 delay
B = 60 second delay
C = 120 second delay

Thanks for the detailed reply! That answers my concern :)

Yeah, after writing this, I had put some thought into it and decided instead of attempting to spawn 3 different trains in the same spot separated by time, I'll just go spawn 3 trains in 3 locations as soon as possible so they are all equally spaced for the most part, and that seems to have fixed the problem.

And that explains the trains continuing to spawn. It was making me crazy because I thought its just going to continue spawning trains until my server crashes, but in reality its just trying to spawn and maintain the 1 train and keep it on the tracks when I kept removing it because I wanted to edit/add more trains before it left the station so it seemed out of hand but it wasnt.

So my issue was my common sense told me I can spawn trains in that one spot at the Main Station, but that doesnt work like you said. Not sure if thats something that can be outlined in the description because its a bit unclear, I love the plugin and have enjoyed its use for my server!  Thanks for your contribution to the Rust community and for getting back so fast!

I'll improve the docs. Thanks for the feedback.

Locked automatically