Train help?

Jan 8, 2011
397
393
I've been looking for a good tutorial on trains, but I can't seem to find one. I want a train similar to the ones in well (random timer, flashing lights and bells), but all the tutorials are either too basic or not what I'm looking for. So far, the closest I've gotten is a train that runs along its track, then teleports back to the start of the track and runs it again, over and over. If anyone could point me to a good tutorial, or just explain it here, that'd be great. Thanks a bunch! I look forward to sharing my project with you guys.
 

Mr. Happy

L6: Sharp Member
Jul 16, 2008
320
158
So do you want to stop the train so you can trigger it at random intervals? Do you not know how to do the flashing lights?

If you need help with the complete package rather than just an aspect of two it might be most helpful for you to decompile well and take a look (you can also download the valve maps decompiled) in Hammer yourself.
 
Jan 8, 2011
397
393
Basically, what I want is for it to stop, so I can trigger it again at random intervals. It would probably be good to look at the decompiled map and self teach (or copy/paste ;) Teaching myself tends to work well for me. The reason I didn't want to look at decompiled Well in the first place was because it probably has a lot of irrelevant stuff (like the things they use to transition to the skybox train).
 

ardysqrrl

L4: Comfortable Member
Oct 26, 2009
173
159
I usually just control trains with their SetSpeedDir value; 1 for the train's max speed, 0 for stopped, -1 for reverse max speed. (Reverse and StartBackward have some glitches that SetSpeedDir with a negative value seems to avoid when I've tried it)

Triggering again using random values sounds like use of a logic_timer possibly in conjunction with a logic_case

What starts the train going in the first place? Does it start at the beginning of the map moving along the path and then stops and reverses at random?
 
Last edited:
Jan 8, 2011
397
393
Not quite. The train isn't on any particular trigger; just a random logic_timer. As for going backwards, I just want it to go back to the beginning of the track ('teleport to this track' flag), but not start moving again.
 

ardysqrrl

L4: Comfortable Member
Oct 26, 2009
173
159
you won't be using that flag unless you always want it to "jump" at a certain place; rather the TeleportToPathTrack input on the func_tracktrain will do what I think you want to do. setspeeddir 0 at the same time will make it stop moving.

let me know if you have any difficulty putting it together