This tutorial will hopefully explain how the func_train rotating entity works in KP. It's a pretty complicated entity, but I will try my best to explain it :)
Firstly, you are not limited to 1 train per map. The map I'm currently building has 2 func_train rotating entities in it, plus an normal 'straight line' train, and it runs no problem. Now, down to the nitty-gritty: First, you must build your carriage. This can be any size or shape you want, just make sure it isn't too big(long/wide), to fit around any corners you make. In the horizontal plane, this entity will not make a sharp 90 degree turn,(well, it actually will, but it can't look very realistic) it looks better going around nice round corners that aren't too sharp, which is why you have to make sure the carriage size will look realistic as it takes the turn, especially if going thru a tunnel... too long, and both ends of the carriage will disappear into the walls as it goes around the curve.
Ok, once you have built your carriage, put an origin brush in the center of it, both horizontally and vertically. This brush should be big enough to enclose a path_corner, no bigger. Now you can select all the brushes that make up your carriage, plus the origin brush, and make them a func_train rotating. Yeeehaaaw!! Well, no, not really...that was the easy bit.
If you're building a single carriage train, target the train to the first path_corner in your route(starting point), which is in turn targeted as normal to the next path_corner etc.Note: The train will spawn with the origin brush over the path corner, so all your path_corners should be at the height and position of your origin brush, i.e. center of the track, not based on the bottom left hand corner of your carriage like in a 'normal' train. Then it's just a matter of targeting your path corners as normal to define the route the train takes.
If you are building a multiple carriage train, then in addition to the above, place a path_corner inside the origin brush. This is totally separate from the path_corners defining your route; these are used to join the carriages together into one train. Each pathcorner in each carriage you make, targets the path corner in the next carriage, starting from the back of the train. Only the path corner in the front carriage (loco) targets the spawn point path corner. Also, each func_train rotating(carriage)is part of a team. So, the keys for each of your carriages would be: Target=(pathcorner inside) dmg=(whatever; default=2) noise=(train noise) team=(team name). All of the train carriages including the loco must be part of the same team.
Now the complicated stuff...The path corners that you use both in the carriage and over the track have 4 key values:Target, Targetname, Rotate, and Speed. (There is also a key named 'reactdelay', but I'll touch on that later). First the carriage pathcorner(multiple carriage trains only): Target and Targetname are obvious: Target=where the train is going to spawn(loco only-all other carriages target the next carriage, starting from the back of the train); Targetname is what the carriage (func_train rotating) is targetting. Speed=start speed (fiddle with this until you get what you want..220 is a good starting speed, depending again on how big your train is) and Rotate= rotation in the x y z planes. I don't think you have to use the rotate key in the pathcorner inside you carriage, I'm pretty sure this is only used in the path corners outlining the train route. I put the key in my carriage path corner, and just left it all at 0... i.e. rotate= 0 0 0 This determines which way the carriage is going to turn (rotate), and is used in the path corners you place around your map. The increment used in the game is 2.5, so that's what I used in my map. eg: rotate=0 0 2.5 - 0 rotation in the x plane, 0 rotation in the y plane, and 2.5 rotation in the z plane.
Putting a minus sign(-) in front of any of these will simply reverse the direction of the rotation. You MUST put all three numbers in. So, if your carriage is going to go down a hill and straighten up again as it reaches level ground, you would put something like this in the path corners thru which your carriage will be moving; at the top of the hill: target = t1 targetname=t2 rotate= 0 0 2.5 speed=220; at the bottom of the hill: target = t3 targetname=t1 rotate= 0 0 -2.5 speed=220. Now the increment of 2.5 is not enough to turn the train much, so you have to keep your path corners close together when it comes to rotation points, in fact you should butt them together with the same settings until the rotation you desire is achieved, at which point your next path corner will have a rotation of 0 0 0 so your train will hold that angle until you want it to rotate back again. This is also where the speed factor is important; if your train is moving too fast, it won't look right, or have time to complete the rotation before it is out of the corner, so understand you have to do a lot of trial and error. There are too many variables possible to pinpoint exactly how much and how fast: length of corner, speed of train, steepness of grade etc, so you gotta fiddle around with this until you find a happy medium to suit your particular map. Confused yet? I promise to put a sample map up here as soon as I get the time.
I noticed in the original game train that every 2nd carriage had the reactdelay=2.5 key, but I have no idea what it does, so I put it mine just in case :) You must also enter the same line:reactdelay=2.5 and the train speed into the worldspawn settings. Once again I'm not sure why, but it works, so what the hell..
So there you have it. This is a very difficult entity to explain in words, so I will try to get a sample map up here soon. Just remember, that to go around a corner or down/up a hill, don't make the bend too sharp, and keep your pathcorners close together around/over the bend, and make sure the last pathcorner has no rotation set before sending the train down the track after completing the turn, because it will just keep on rotating as it goes if you don't tell it to stop. I've also had trouble riding on one of these as they go thru a turn, so I'm not sure if that is possible with this entity.
Download the tutorial source .map files from here.
Hosting services provided by Poisonville.NET/Kingpin
Forever Headquarters |
![]() © 2003
Kingpin Forever Network (aka KP4EVER)
All community contributed items and/or hosted sites are the property of their respective authors. Our goal is to maintain and archive all pertinent Kingpin related materials, all original sources are noted if known. About Us | Terms of Use | Privacy Statement | Opt-In/Opt-Out | Accessibility |