A mission train drives itself on cruise speed alone — no conductor ped needed; conductor=true is unreliable for AI. Spawn conductor=false + SetTrainCruiseSpeed + persist
Context
You want an AI / ambient train that drives itself along the rails (a "ghost train" that runs stations on its own). The _CREATE_MISSION_TRAIN (0xC239DBD9A57D2A71) docs say "to make the train AI controlled, set conductor to true and set the speed once" — so the obvious move is conductor = true (8th BOOL).
The trap (verified in-game, build 1491)
Spawning with conductor = true and expecting the AI conductor ped to drive does NOT work reliably — the train sat still / didn't drive, and (separately) the conductor ped occupies the driver seat (see the related conductor-seat finding). Relying on the conductor ped for AI movement is a dead end.
The fix (verified — ghost train drove the full network and stopped at stations)
A train on rails moves from cruise speed alone — it does not need a driver ped at all. Spawn with conductor = FALSE, mark it persistent, and set cruise speed:
local t = Citizen.InvokeNative(0xC239DBD9A57D2A71, configHash, x, y, z,
direction, false, false, false) -- conductor = FALSE
Wait(500)
SetEntityAsMissionEntity(t, true, true) -- 0xDC19C288082E586E — persist (don't get culled)
Citizen.InvokeNative(0x4182C037AA1F0091, t, false) -- _SET_TRAIN_STOPS_FOR_STATIONS off (you control stops)
Citizen.InvokeNative(0x9F29999DFDF2AEB8, t, 22.0) -- _SET_TRAIN_MAX_SPEED (use <30.0; 30.0 breaks it)
-- to drive:
SetTrainCruiseSpeed(t, 22.0) -- 0x01021EB2E96B793C
SetTrainSpeed(t, 22.0) -- 0xDFBA6BBFF7CCAFBB
-- to stop at a station: ramp cruise down to 0 (set both cruise & speed to 0).
There's no visible driver, which is fine — that's normal for rail. To make it stop at a chosen point, poll distance to the target and ramp cruise speed to 0 (instant SetTrainHalt freezes with no braking; ramping looks natural).
Practical notes:
_SET_TRAIN_STOPS_FOR_STATIONS(t, false)disables the engine's own random station stops so YOU control where it halts.- Mark it a mission entity or the engine may cull it when no player is close.
- This is the foundation for a scripted timetable train. The conductor ped is only relevant if you want a visible crew member, not for movement.
Linked natives
_CREATE_MISSION_TRAIN(0xC239DBD9A57D2A71)SET_ENTITY_AS_MISSION_ENTITY(0xDC19C288082E586E)SET_TRAIN_CRUISE_SPEED(0x01021EB2E96B793C)_SET_TRAIN_MAX_SPEED(0x9F29999DFDF2AEB8)SET_TRAIN_SPEED(0xDFBA6BBFF7CCAFBB)_SET_TRAIN_STOPS_FOR_STATIONS(0x4182C037AA1F0091)
Tags: trains, vehicles, mission-train, ai, conductor, cruise-speed, railroad
Category: natives
Source: scandi-railroad-poc
Created: 2026-05-22T19:25:25.595Z