Need help with trains (quite urgently)

  • If you're asking a question make sure to set the thread type to be a question!

Vel0city

func_fish
aa
Dec 6, 2014
1,947
1,589
So I have a train which is roughly 2400 HU long and consists of 4 cars, including engine. The engine is parented to a func_tracktrain which moves over a simple path_track while all the other cars are parented to one another (the second car is parented to the engine, the third car is parented to the second car, etc). The problem here is that I can't have just 2 path_tracks, or else the train gets deleted while it's still visible to the player (it's out on a bridge above a dam), so I made a third track that moves behind a wall which the player can't see. And here's the problem.

I'm limited to the 4096x4096 size limit of the map (detailing contest so yeah), so I can't have my 2nd waypoint out a long distance to ensure the train is completely blocked to the player's view before I teleport it back to the first waypoit, where it waits until a timer says it to start going again. So, I've added an extra waypoint that moves the whole train behind a big wall that's part of the scenery so the train continues moving until it's completely out of sight before it can teleport back again. However, as soon as the train passes the 2nd waypoint the whole thing suddenly rotates to face the 3rd waypoint which makes every car (3 out of 4) rotate and clip trough the bridge it's on and trough the wall it's supposed to hide behind, all while it's still visible to the player.

Is there any way to tell the individual cars to turn on the waypoint while keeping the other cars moving in the same direction instead of the whole train truning at once? Do I have to make individual func_tracktrains for every car and then fiddle with timings to get them behind each other while visible to the player? Or can I use 1 func_tracktrain on the first train car and then tell the other cars to keep going to the 2nd path_track while the car before it has already turned to face the 3rd path_track? And no, I'm not gonna cut cars to make the train shorter. That's the whole point here.
 
Last edited:

Vel0city

func_fish
aa
Dec 6, 2014
1,947
1,589
Make individual func_track trains, and have their first path_track be the distance between them all that you want. Then, have them all move forward at the same speed. Don't parent them to each other.

It sort of works, but how do I get the individual cars to teleport back to their spawn point while and stay there until the timer says to start moving again?

In other words: how does Valve do it on the 2nd stage on Cactus Canyon, where they have multiple wagons spawn behind each other and then wait on the timer once they're done traveling along the track? I have exactly the same situation here just with fewer trains.
 
Last edited:

Crash

func_nerd
aa
Mar 1, 2010
3,315
5,499
What I'd do, parent a long func door (length of the train or however much you need) to the train entity and all the train props to the door. Have it set up so when the door opens, it's moving forward straight in front of the train. Then get rid of your extra turn and detail the map so it looks like it's going straight into a tunnel or something.

Set it so the train immediately stops when it gets to the last path and then triggers the door to open. If you trial and error it for awhile, I'm sure you could get it to be a smooth transition and it will look like the train just continues forward.

Have it set up to teleport to the first path after the door is fully open and then close the door again out of sight.

This will let you push it part the size limits without actually building anything out of it.

Sorry for any typos, on mobile. Let me know if that makes sense.
 

UKCS-Alias

Mann vs Machine... or... Mapper vs Meta?
aa
Sep 8, 2008
1,264
816
Why not simply having 4 path_tracks at the start where each of them is ment for a train section to be teleported to? I think its far easier to do that. You dont have to use train_* then and time the moment each cart has to leave:
train_1 goes to to the 4th path_track
train_2 goes to to the 3th path_track
train_3 goes to to the 2th path_track
train_4 goes to to the 1th path_track
If each car is 512HU long the path_tracks simply have to be placed 512 HU apart.
And at the end you just ensure the whole train is in so the last path just teleports the 4 sections back and stops the train.

It costs a little more in entities to place each train part but its much easier to create.
 

Vel0city

func_fish
aa
Dec 6, 2014
1,947
1,589
I bailed on it. Now it's just a simple single loc, but it shouldn't be too much of an issue. Too much awesome scenery going on at ground level. Nobody will look up (unless you hear the horn).