Classnames: | path_corner |
Purpose: | Directing movements |
H2 Code: | path.hc |
Fields required: | targetname |
path_corners entities specify destinations for monsters and trains, and are fairly complicated, providing linked sequences of destinations where each destination specifies the next, and various aspects of the behavior of trains especially can be specified. I've done some experimentation with this but may well have messed some things up. You might also want to have a look at Eutectic's discussion, which I've attached to the end of this one (you'll see where I've just cribbed from him). I feel particularly unsure about the use of anglespeed and the SYNCH spawnflag to produce good-looking turns. |
targetname | Value is a name; train or monster with this as their target-value will head off for this path_corner. (Required). |
target | Value is a name, targetting the next path_corner that the monster or train will move on to. |
wait | Value is a number, time train waits at this path_corner, overriding any wait-value on the train. A wait-value of -1 stops the train, and while a wait-value of -2 causes the train to explode, after the delay specified in the train's pausetime field. Explosion doesn't work if the train's TOGGLE spawnflag is set, but -1 will stop the train, unrestartably, but after it does any turn on the corner. |
speed | Value is a number, speed train moves to this path_corner, but note that this doesn't work unless the path_corner also has an angles field. |
anglespeed | Value is a number, default = 100, speed of rotation between the previous path_corner and this one. If set to 0, it will use the last path_corner's anglespeed value or the train's anglespeed value if it's the spawn path_corner. Setting the SYNCH spawnflag will override both this value or the last path or train's value if set to 0. |
angles | Value is a triple of numbers in the `mangle' (Y Z X) format; how much
to rotate a train's orientation by. So 0 -90 0 will be a 90 degrees
clockwize rotation around the Z (vertical) axis; what you'd want for
say a boat making a 90 degree clockwise turn. It's somewhat confusing in that the angles field on a path_corner indicates the turn made on the way to that path_corner from the previous one, except that, wierdly, the train will rotate immediately by the angles field of the path_corner that it spawns at. So for example if you want to have a train run a square route in a cycle, you need six path_corners, the first two with no angles field (or, equivalently, 0 0 0), the remaining for with 0 -90 0 (for clockwise travel), and the sixth targetting the third, with the fifth and sixth occupying the same position as the first and second, respectively (hey, did I remember to say that this was confusing?). Anyway, that's what it looks like today; maybe there's actually an easier way to do it. |
spawnflags | 1 SYNCH - Will make the train automatically calculate a new anglespeed based on the distance it has to travel and will finish the turn at the same time the move is done (when it arrives at the path_corner). Has no effect if path_corner is used for monsters |
Name: path_corner Description: path points for trains and monsters. Paths must all have a valid target Bounding box size: (-8 -8 -8) (8 8 8) Keys/Attributes: speed: 100 (default) speed of displacement between the last path_corner and this one. If set to 0, it will use the last path_corner's speed value or the train's speed value if it's the spawn path_corner. anglespeed: 100 (default) speed of rotation between the last path_corner and this one. If set to 0, it will use the last path_corner's anglespeed value or the train's anglespeed value if it's the spawn path_corner. Setting the SYNCH spawnflag will override both this value or the last path or train's value if set to 0. angles: how much to modify the train's angles by. This value is cumulative to the train's last position so if you set it at '0 90 0', and the train was at an angle of '30 60 90', the train will rotate until it's angles equal '30 150 90'. Mangle type value: (Y Z X) in that order target: points to the next path_corner. All path_corners must have a valid target otherwise the game will report an error and the map won't load targetname: name of the previous path_corner's target or the train's or monster's target if the path_corner is the spawn path. Spawnflags: 1 = SYNCH: Will make the train automatically calculate a new anglespeed based on the distance it has to travel and will finish the turn at the same time the move is done (when it arrives at the path_corner). Has no effect if path_corner is used for monsters Notes: trains must have at least 1 path_corner in order to spawn in the game at all and at least 2 to function as moving train. If one of the paths don't have a valid target, the game will report an error and the map won't load (loop that loop). The train will spawn at the first path_corner's location. Also, never use a wait value of -1 on the spawn path_corner otherwise the train will never move even if it's triggered. The train's sound only goes "ka-klunk" and stops on paths with a wait value > 0 , it doesn't stop on paths with wait set to -1. The only way around this for a triggered train is to set the soundtype to 0: no sound. The train will modify it's angles by whatever angles it's next path point has, so if it heads towards a path corner with an angle of '0 90 0', the train will rotate '0 90 0' along the Z axis on it's way to the pathpoint. If you make the anglespeed the same as the angle, the turn should finish right as the train gets to the new spot. The SYNCH spawnflag does this automatically