Age old question: "Load until full or next train arrives" function?

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

Post Reply
testwater
Engineer
Engineer
Posts: 2
Joined: 16 May 2026 04:03

Age old question: "Load until full or next train arrives" function?

Post by testwater »

Fairly novice player, using JGRPP.
What I'm trying to do is get a train which is stopped while loading to full, to depart early because the next train in the group is arriving at the same station.
I have not been able to automate the equivalent of this with auto separation, conditional orders, or unbunching. Trains leave station far to early with these options, and I hope to find a way to do it that relies on some kind of triggering event, rather than micro-managing scheduling or number of cars on train.
For example, is there any way to make it so that a train automatically advances to the next order # on its list once another train from the same shared-orders group advances to the same order #?

Train Group 1 contains
Train A
Train B
Train C

Group 1 has shared orders,
1) Go non-stop to Station W [full-load passengers]
2) Go non-stop via Waypoint X
3) Go non-stop to Station Y [full-load passengers]
4) Go non-stop via Waypoint Z


Image
Example.jpg
(76.37 KiB) Not downloaded yet

Train A is on order #3, stopped and loading at Station Y
Train B is on order #2, traveling from Station W to Waypoint X
Assume Train B is about to pass Waypoint X and advance on to order #3 before Train A has a full load of cargo at station Y.
Is there some kind of script or patch that can use either, a train passing a waypoint, or two trains from the same group being on the same order, as a trigger to make a train advance on to the next order on its list?
User avatar
paulcobbaut
Engineer
Engineer
Posts: 17
Joined: 20 Apr 2017 08:19

Re: Age old question: "Load until full or next train arrives" function?

Post by paulcobbaut »

I like this question!

Expanded: when a station has multiple platforms that are all occupied, and a new train arrives, then one train should leave the station. Which one would ideally be a choice of 'the fullest' or 'of the same group' or 'the one that is there the longest time'...
--
Sent from Debian Linux
User avatar
odisseus
Chairman
Chairman
Posts: 828
Joined: 01 Nov 2017 21:19

Re: Age old question: "Load until full or next train arrives" function?

Post by odisseus »

There are work-arounds for these issues, feasible even in the unmodifed game.

A self-regulating network ensures that the number of trains that arrive at the station is exactly sufficient to take all the supplied cargo. The situation when multiple trains are queued for loading just won't occur.

An overflow depot hides the queue away so that the waiting trains don't take space on the tracks. This solution doesn't eliminate the queues, but it's much more flexible than SRNW, and much easier to set up.
testwater
Engineer
Engineer
Posts: 2
Joined: 16 May 2026 04:03

Re: Age old question: "Load until full or next train arrives" function?

Post by testwater »

I appreciate your suggested workarounds, Odisseus.

I've already been using the depots to tuck away waiting trains, as that is the most reasonable solution I've found that doesn't involve perpetual micromanagement, but still I'm here in hopes of something less cheesy.

I had not yet come across the SRNW idea. I'll have to read about it. Thank you.
Michpi
Engineer
Engineer
Posts: 65
Joined: 03 Feb 2021 18:51

Re: Age old question: "Load until full or next train arrives" function?

Post by Michpi »

You can use counters and conditional orders for this
[+] Spoiler
1.jpg
1.jpg (282.34 KiB) Viewed 323 times
User avatar
paulcobbaut
Engineer
Engineer
Posts: 17
Joined: 20 Apr 2017 08:19

Re: Age old question: "Load until full or next train arrives" function?

Post by paulcobbaut »

So I tried this counter...

Why are the trains not leaving the station?
The counter is named 'gogogo'. The counter is increased when a train passes the signal with blue arrow, and the counter is decreased when a train passes the pink arrow signal. This works.

Now I thought a train would 'jump to order 4' when the counter is above 2. But they just sit there in the station. (All trains have shared orders.)

What am I missing?
The goal is to keep the trains loading in the station, until a third train arrives, then one of them should leave. (So the pink signal will need to be set at every station exit later on.)

EDIT: Removing the 'full load any cargo' makes them all leave at the counter threshold. Ideally only one of them should leave.

Image
openttd counters Screenshot_2026-05-28_19-34-36.png
(744.11 KiB) Not downloaded yet
--
Sent from Debian Linux
User avatar
paulcobbaut
Engineer
Engineer
Posts: 17
Joined: 20 Apr 2017 08:19

Re: Age old question: "Load until full or next train arrives" function?

Post by paulcobbaut »

Found a solution, using a counter as a boolean.

Thank you for the hint on counters!

Image
openttd counters Screenshot_2026-05-28_22-37-41.png
(571.33 KiB) Not downloaded yet
--
Sent from Debian Linux
Michpi
Engineer
Engineer
Posts: 65
Joined: 03 Feb 2021 18:51

Re: Age old question: "Load until full or next train arrives" function?

Post by Michpi »

paulcobbaut wrote: 28 May 2026 20:43 Found a solution, using a counter as a boolean.
I may be mistaken, but as far as I understand, in your case, the full train will not leave the station until the third train arrives.
User avatar
paulcobbaut
Engineer
Engineer
Posts: 17
Joined: 20 Apr 2017 08:19

Re: Age old question: "Load until full or next train arrives" function?

Post by paulcobbaut »

Michpi wrote: 29 May 2026 08:47
paulcobbaut wrote: 28 May 2026 20:43 Found a solution, using a counter as a boolean.
I may be mistaken, but as far as I understand, in your case, the full train will not leave the station until the third train arrives.
Adding a check at the beginning for 100 percent load seems to work. Like in this picture.
Image
train.png
(57.32 KiB) Not downloaded yet
--
Sent from Debian Linux
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 1 guest