Some RDR3 track junctions auto-switch and pull trains onto a wrong parallel track (e.g. Thieves' Landing) — force them with SetTrainTrackJunctionSwitch continuously, no player toggle
Context
You drive a player-controlled mission train along the rails and at certain junctions the train gets yanked off the main line onto a wrong parallel track — even when you never touched a switch. The classic spot is the Thieves' Landing / MacFarlane area junctions on the TRAINS_OLD_WEST01 track config.
The trap
A subset of the game's track junctions behave as "auto" switches: their default state diverts a passing train onto a side/parallel track. These are NOT meant to be player-facing switches — they have no lever/blip — but if you leave them at their default state, or worse if your global switch logic toggles them, the train derails off the intended route. Paid scripts (rsd_railroad) explicitly flag these with comments like auto = true and -- FIX THIEVES LANDING SWITCH.
If you build a "switch all junctions" toggle by brute-forcing SetTrainTrackJunctionSwitch over every index, you will ALSO flip these auto-switches and make the problem state-dependent.
The fix (verified in-game, build 1491)
Maintain a small list of these auto-switches (trackConfig name + junction index) and continuously force them to the through-route state, independent of any player toggle. Also EXCLUDE them from any global brute-force toggle so it can't override them.
-- Thieves' Landing area: TRAINS_OLD_WEST01 (joaat), junctions 0 and 1, forced true
local autoSwitches = {
{ track = 'TRAINS_OLD_WEST01', junction = 0, state = true },
{ track = 'TRAINS_OLD_WEST01', junction = 1, state = true },
}
CreateThread(function()
while true do
for _, a in ipairs(autoSwitches) do
SetTrainTrackJunctionSwitch(joaat(a.track), a.junction, a.state)
end
Wait(2000)
end
end)
Re-applying every ~2s is enough; the state persists but a periodic re-assert is robust against the game resetting it. Forcing true kept the train on the main line through Thieves' Landing. (Which boolean is "through" vs "divert" varies per junction — test both; for these two it was true.)
Note: which exact junctions are auto/broken on YOUR map depends on the loaded traintracks.xml. The readable rsd_railroad/config/config_switch.lua lists them with auto = true + direction = {true, true}; mine the coords_switch/coords_action near the problem fork to identify the trackConfig + index.
Tags: trains, vehicles, track-junction, railroad, switch, thieves-landing
Category: natives
Source: scandi-railroad-poc
Created: 2026-05-22T18:27:50.303Z