[RELEASE] FiveM Freight train (AI) and enterable trams (as passenger) (Suited for Roleplay to)

[quote=“Vespura, post:6, topic:268613”]
As for the doors that you can’t walk through, you have to remove (delete) the vehicle doors on the side of the platform, however you can only restore them by fixing the vehicle sadly :confused:

Yeah i figured that part out to (the needing to fix the vehicle) so i’ve decided to not make it to ‘overcomplicated’ and just leave it as it is, since the doors (even though invincible) can still be used as cover now in for example hijack or ‘terrorist roleplay’ scenarios.

Well it seems like that the original resource i’ve used does the job quite well. I have to admit that SOMETIMES we have a de-spawn, but most of the time it works just fine, i’ve set them to mission entity’s, invincible etc to ensure they are ‘high prio’ in the game (seems to work, i remember this
from my days in GTA IV when making Realism mods) and tried it here again.

However IF it despawns, it’s not much of an issue since on next connect or when there is a moment
that the server has 0 players it will instantly create new trains and make that current player host.
When the other players join then, they seem to take over the missionentity registration :slight_smile:

We have tested it several times and it SEEMS to work out quite well, lets just hope it keeps working
this well, and if someone finds issues please do report them.

I don’t work (much) on this mod anymore since it’s just a ‘side feature’ of our server so it will only
get attention when someone notifies me of issues haha.

4 Likes

I just checked and indeed, the above ground ticket machines are not models. You would need to provide coordinates instead.

Good work!

4 Likes

Thanks for confirming! :smiley: (Don’t have a map editor or so installed).

I suspected this already (that they where part of the 'TrainStationMapPart/Component)

I might then in the future add them as small vectors with a radius like 0.5 or so :slight_smile:

BTW:
@d0p3t Do you have any tip on how to “more easily” find the modelname of
objects while in game? (for example when i see an object and get the hash
from it with my own “GetNearestObject” function, but then i will need to get an ‘easy way’ to get the model name… I know how to in most games like Fallout, NV, GTA SA, IV etc, but not for V… do you have any recommendations? or will it really be:
“Searching in hash lists made by others?”

1 Like

You can try this - Basic In-Game Debug Tool (LUA) :stuck_out_tongue:

3 Likes

@XIII Are you f*ing kidding me? :rofl:
Didn’t even knew about that simple solution hahaha

BUT does that model ID refer to a ‘permanent’ model number and is it
directly callable in my own scripts? like: "RequestModel(‘12345567’)
Or is it a (session or file/dlc) addressed number like in games as fallout for example?

Edit: Since i had made a simple scanning (to console) function, but the issue i had
there is that it only returns the hash, and i’m not certain if i can just use the hash
as a permanent solution to spawn/call or interact with objects.

Thanks

3 Likes

I use the entity debugger of Mooshe’s DevTools (available on the forum)

4 Likes

Will i need to add in TRAINS! or does your script do it? I been waiting in the subway station for 20 minutes no train… lol… but i have purchased a ticket and it says the bank and everything.

Same here. I even flew around and did not see any trains. The very first time though I saw a freight train sitting on the subway track not moving.

I moved the script near the top of my start order and now 2 freight trains spawn and sit on the metro line.

still no train… no clipped everywhere… and never found one.

I can get them to spawn, but it is the freight train on the subway line and it just sits there. Hopefully someone can get this working.

So everything seems to be working L:)

I am wondering if there is a way to add more train cars to the freight train? (to make it longer)

1 Like

Are your trains moving and the freight train on the right track?

I’m currently working on seeing where the problem is, it LOOKS LIKE IT, that we don’t have issues when we test it locally (on a LAN hosted server), not even with multiple people.

BUT now we have tested it with a 100% remote hosted server (one at my company) and we all played while remotely connected to that server, and then it WILL de-sync and even ‘de-spawn’? the trains.

The drivers however WILL remain, they will be ‘left in the open’ ON the track (I assume at the position where their train previously was).

I guess it has something to do with the game handling the trains and NOT fully
recognizing them as mission objects/entity’s.

I will try as soon as possible if it’s in some way possible to ‘remove them from the
respawn buffer/list’ (or however GTA V Rage handles it) or if there is a way how I
can mark them as a ‘crucial item’ for the game. (which should do the same).

Alternatively I can try to look for alternatives to ‘alternate’ between ‘hosts’ for the
train (since AI and such is ‘hosted’ by the clients nearby). But all these will be
quite difficult to keep managed since all of these options would have to be with
Natives I assume.

Will see if i can find anyway to solve it.

For now people CAN test the trains by using /XNLforcetrains command.
BEWARE THOUGH!: That command is NOT limited to admins or so!

I have updated the repositroy (on my github) with a new(er) client.lua which
decreased the risk of the train (freight) being on the wrong track.

However i will look into the other problem asap.

WARNING: When using the XNLforcetrains command, it will NOT cleanup the
previous trains, even though I call DeleteAllTrains, i suspect this is since they are
mission trains. The other ‘downside’ to this is that if i would ‘start hosting them’,
and create the trains for the session, and i would then leave… then my buddy whom
would still be in the server CAN NOT delete the mission trains since I’m the one
whom created them with the refrence. So he has no pointer at all to delete them.

And as far as i know: We can’t stream vehicles via the server (yet) like we could
do in SA-MP for example.

BTW: Sorry for my late reply, i already noticed yours instantly when you posted it, but could not reply anymore (at the moment I’m still a limited member since this account is ‘brand new’. I will however try to do my best and update/help where i can :slight_smile:

The new (updated) version at my github, now logs to console which train(s) are loaded and even if it needs to wait to load the model. However you should have been able to see the peds (traindrivers) somewhere on or near the track (idling), since that happened to us everytime we forced the error situation to happen.

If they don’t spawn then it means it didn’t run the script at all though.

Looks fine to me

2 Likes

Yeah for most part it also works great for us to (except for the part where it takes ages to wait for the Metro (but okay there are only one or two (depending on your setting) on the rail haha)).

But we did indeed encounter the same issue now when doing a longer session where we intentionally
did RP sessions as far away from the railtracks to see if it would cause a ‘de-spawn’ if people didn’t came
near the rail roads.

HOWEVER: The freight train seems to have the least problems and kept going quite long without issues. It did started ‘trippin’ when i used the /XNLforcetrains command to respawn them all
(making the carts just ‘de-spawn’ while we where on it DAFUQ? haha

Hmm also Wondering now if different gamemodes (ESX, vRP, VenmousFreemode etc) could cause/have a different effect (for example when doing vehicle/mission cleanups.
Same goes for traffic density settings (would they affect it)??
Will definitly look into those asap tomorrow (first working on the Character Creation screen now (fully functional like GTA:O itself :D)

Forgot to reply to this, yes it’s possible, i have already had it (randomly) that it had a massive length haha,
will see when the main issue has been solved IF i can make it ‘override’ in the settings part of the
script so users can define their min and max length for the Freight (no promises yet though).

That would be amazing !

I am going to start working on a YMAP for the ticket boxes so that they can be added and used above ground or at stations that do not have working ones.

1 Like

Thanks would be great, since it can take some time due to the fact i still have lots of stuff to do to build up everything here from scratch (by own choice :wink: ).

But PLEASE do not put to much effort in it, since i have already ‘wasted’ quite some hours
on it if it turns out that it isn’t syncable yet in this stage of FiveM.
Maybe even the FiveM team will comeup with a new native or ‘ped syncing’ mechanism
overtime which would improve it, so it’s never a full waste of time haha.

So far it works great (as long as the trains don’t get abducted by the UFO’s :P)
Hope to get it fully functional :slight_smile: