[HELP/SOLVED] Streaming "trains.xml" with Custom Train Container Models

I have been browsing forums and trying to find answers about how to stream the “trains.xml” file with custom train cars in it. I had a 3D developer duplicate the freight car trains so we have the models listed below to spawn in:

frieghtcont1
frieghtcont2
frieghtcont3 -- new
frieghtcont4 -- new
frieghtcont5 -- new
frieghtcont6 -- new

However if I just try to stream the modified trains.xml file using data_file 'TRAINCONFIGS_FILE' 'data/trains.xml' and listing the file under files {} it does not do anything.

I went as far as modifying and streaming the gta5.meta file with the custom trains.xml path. This just immediately crashed my game if I ran train config 0 or 10 (ones I’ve modified for testing) here:
trains.xml (32.2 KB)

The end goal here is to run a train config to spawn in my custom train group with the custom train cars.

This is my fxmanifest:

fx_version 'cerulean'
game 'gta5'

files {
    'data/trains.xml',
}

data_file 'TRAINCONFIGS_FILE' 'data/trains.xml'

SOLVED!

After diving into the CreateMissionTrain native it said it right in front of my face. You must request the model and load it before the train spawns using the RequestModel native.

I still had to modify the gta5.meta file to make this work. There is an explanation here.

1 Like