<!-- fivemad.com, Markdown source of https://fivemad.com/redm/docs/tools/train-tracks -->
> Source: https://fivemad.com/redm/docs/tools/train-tracks
> Section: Tools
> Tags: trains, traintracks, trainconfigs, trolley, riverboat, _CREATE_MISSION_TRAIN, junctions
> Tool: https://fivemad.com/redm/tools/train-tracks
> Last updated: 2026-10-01
> Site map for assistants: https://fivemad.com/redm/llms.txt

# Train Tracks

Every RDR2 railway, trolley, mine cart and riverboat track on the map, with its junctions, its config group, the trains it runs and Lua to spawn one.

Train Tracks draws every track in RDR2's `traintracks.xml` on the map: 28 of them, from the main railway loop to the Saint Denis trolleys, a mine cart line and the riverboat route. Click a track for its file, length, junctions and config group, then pick a train that runs on it to see its cars and copy the Lua that spawns it.

## What it is for

Spawning a train in RedM takes a train config hash and a point on a track, and neither is something you can guess. This tool shows you where the tracks really run, which tracks connect where, which trains the game lets run on the main line, and gives you the hash and the spawn call in one place.

## Quick start

1. Click a coloured line on the map, or pick a track in the **Tracks** list. The map zooms to fit it.
2. Read the details card under the list: file, nodes, length, whether trains stop at stations.
3. On the main line (`freight_group`), pick a train under **Trains this group runs**.
4. Check its cars, then copy the Lua or press **Config hash** to copy just the hash.

## The tracks

The list labels each track by what its config name says:

| Kind | Tracks | Examples |
| --- | --- | --- |
| Railway | 10 | `freight_group` (the main loop), `braithwaites2_track_config`, `trains_old_west01` |
| Trolley | 7 | `nb_trolley_track_config`, `trolley3`, `trolley_intersection2` |
| Junction link | 9 | `trains_intersection1_3`, `freight_nb1_inter` |
| Mine cart | 1 | `minecart_Jam3_4` |
| Riverboat | 1 | `riverboat_track_config` |

Together they run to about 46.6 km. The longest is the main loop in `trains1.dat`: 473 nodes, about 15.02 km, a closed loop. The riverboat route is 432 nodes and about 9.13 km, also closed.

On the map each track has its own colour. The selected one turns white and the others fade. Dots mark junction nodes: on the selected track always, and on every track once you zoom in.

## Track details

| Field | What it shows |
| --- | --- |
| **File** | The track file the nodes come from, for example `trains1.dat` |
| **Index** | Its position in `traintracks.xml`, counting from 0 |
| **Nodes** | Node count, the length in km, and whether it is a closed loop |
| **Stations** | Whether trains on it stop at stations |
| **Group hash** | The config group the track names, in hex and signed, or **not in trainconfigs.ymt** |
| **Junctions** | Every node the track file marks as a junction, with the name written on it (usually the track it joins, sometimes a station such as `Station_rho`). Click **node N** to fly to it. |

There are 132 junction nodes over all 28 tracks.

## Trains

A track names a config group, and a group lists the trains that may run on it. Only one group exists in the game's `trainconfigs.ymt`: `freight_group`, the one the main loop uses. Every other track shows **not in trainconfigs.ymt** and has no train list.

`freight_group` lists 39 trains. 8 of them have a known name (`engine_config`, `dummy_engine_config`, `handcart_config`, `minecart_config`, `trolley_config`, `winter4_config`, `prisoner_escort_config`, `appleseed_config`); the rest are listed by hash, which is what the native takes anyway. Each row shows how many cars the train has, from 1 to 18.

Click a train to see its cars in order and get the spawn code. For `engine_config` on the main loop:

```lua title="client.lua"
-- engine_config: 2 cars
local config = 845205129 -- 0x3260CE89
local models = {
    -164452766, -- northsteamer01x
    -544816550, -- northcoalcar01x
}
for _, m in ipairs(models) do
    RequestModel(m)
    while not HasModelLoaded(m) do Wait(0) end
end
-- _CREATE_MISSION_TRAIN (0xC239DBD9A57D2A71): config, x, y, z, direction, passengers, p6 (not documented), conductor
-- here: the first node of trains1.dat
local train = Citizen.InvokeNative(0xC239DBD9A57D2A71, config, 2493.4, -1482.2, 45.1, false, false, false, true)
```

The code loads every distinct car model first, then spawns the train at the first node of the selected track. Change the x, y, z to another node of the same track if you want it elsewhere; it has to be on the track.

**Config hash** copies the signed config hash on its own.

## Tips

- Use the junction list to find where a branch leaves the main line. Click **node N** and the map flies there.
- Trolley and junction link tracks are short pieces (some only 4 to 20 nodes) that join the bigger tracks. If a click picks the wrong line, zoom in further: the click takes the track with a node closest to the cursor, within 10 pixels.
- The car names in the list are model names, so you can look them up in [RedM Assets](/redm/docs/tools/assets) under **Vehicles**, where train cars and engines have their own groups.

## Limitations

- 3 of the 39 trains in `freight_group` have no matching entry in the game's train configs. They show as a hash with no car count, and clicking one shows nothing.
- 58 of the 70 train configs in the game have no known name. They are listed by hash.
- The length is measured flat (x and y only), so it is a little short on hills.
- The meaning of the native's last four arguments is only what the comment says; the code passes `false, false, false, true`. The site cannot test a spawn in game.
- Speed, stopping and driving the train are up to your own script.

## Related tools

- [Interactive Map](/redm/docs/tools/map)
- [Coords Picker](/redm/docs/tools/coords-picker)
- [RedM Assets](/redm/docs/tools/assets)
- [Hash Calculator](/redm/docs/tools/hash-calculator)
