How do I add trains into my server, so the AI are driving them around?
Use the following snippet
SwitchTrainTrack(0, true) -- main track trains
SwitchTrainTrack(3, true) -- main track metro
SetTrainTrackSpawnFrequency(0, 120000)
SetRandomTrains(1)
1 Like
where do i put that at? my server cfg?
In a client script
what script
In a client script. If you don’t know what that is, how the hell are you even running a server?
What he said, a client script is a client.lua typically. This client.lua goes in a resource…
(You also need a fxmanifest.lua or __resource.lua to start it)
When adding random AI trains to the map with the following code, it seems to spawn the trains poorly like solo train cars going around, 3-4 of the same cars attached without a lead car. Train cars being left on the tracks not moving, etc. Anyone know why?
I had found a script that adds AI trains, and had no issues
which is it?
1 Like