Trains.

Demitri Omni

L2: Junior Member
Apr 18, 2008
53
3
Apparently, I can't get this simple thing down. I've made a func_tracktrain, with a large trolley parented to it. It worked fine earlier, except that it keeps ending up spawning backwards. I tried reversing the track itself, but that creates an issue where when it's triggered to move backwards, it just sort of shudders back and forth an inch or so, effectively stuck. I'm also having a model parented to it switch parents with another tracktrain, and I wanted to know if it was necessary to remove the previous parent, or if the the SetParent input would be sufficient.
 

Foreverkul

L4: Comfortable Member
Apr 12, 2008
157
14
Flag 'fixed orientation', unless it turns, then you need to change the turning on the path_tracks.
And I think an object can only have 1 parent so if you set a new one the old one is overridden.
 

Pseudo

L6: Sharp Member
Jan 26, 2008
319
150
Rotate your train so that you see the front of the train in the front (y/z) view. When the train spawns it automatically places itself on the first path_track and will rotate the correct way.
 

Demitri Omni

L2: Junior Member
Apr 18, 2008
53
3
Another question, if I parent a door to the tram, will the move direction rotate along with the tram?
 

Pseudo

L6: Sharp Member
Jan 26, 2008
319
150
Yes. When something is parented all of its angles, directions, and movements become relative to its parent.
 

Demitri Omni

L2: Junior Member
Apr 18, 2008
53
3
Alright, hopefully that will be my last question, I'm about to compile my last build of the startup of my map, if I can get past that, it's honestly the most complicated thing I have going.
 

Demitri Omni

L2: Junior Member
Apr 18, 2008
53
3
(hopefully) final question:

If I set a train to Stop through an i/o, do I need to set a speed if I tell it to go backward? Simply adding an output to move backward doesn't seem to do anything.
 

Jive Turkey

L3: Member
Jan 22, 2008
120
32
From the dev wiki:
Backward movement
Due to coding errors or engine limitations, the Reverse and StartBackward may not function correctly if the "New Train Speed" property in the involved path_track entities is set to 0. The train may fail to reverse, jamming in place or moving in the wrong direction. To solve this issue, some or all of the path_tracks must have their "New Train Speed" variable set to a nonzero value.

The only way I could get mine to behave was to have each path_track have the same speed variable (unfortunately losing some functionality in the process), but even then I never figured out how to solve the ghost cart problem whereby the train would sometimes continue moving with no one on it, presumably because of errors in the OnEndTouch output of the trigger.

Reading about the new gametype payload it appears that Valve may have corrected these problems. I mean I would have to assume they've done something as goldrush seems to function properly. Apparently, with the recent payload addition the func_tracktrain has received a new input called SetSpeedDirAccel. If you set this to a number between 0 and 1 the cart will accelerate to whatever scale of its max speed that number represents. For instance 0.5 will accelerate to half its max speed. Just give it a negative number to have it roll backwards. I have not tested this, but I'm assuming they've finally fixed the damn tracktrain with the newest payload map release. I'm excited to try this out myself, but yea, tracktrains have historically been a pain to work with so good luck.