|
Func_train Tutorial
A func_train is a brush-based entity that you can get to move around in some interesting ways. There are really two types of entities at work in each func_train, a func_train, and a path_corner. In this tutorial, you will see a couple uses for these entities that will hopefully enable you to do more things with your level. The concept of func_train is pretty simple, and being that simple, it's not a highly versatile entity. However, it is very easy to make and has more than a few uses.
Like I already said, we will be working with two types of entities, func_train, and path_corner. The func_train entity is the "train" itself, a brush-based entity. This can be one brush, or a group of brushes. This is the object that you will see moving in the game. The path_corner entities are very different, and as usual, I have an analogy to explain them.
When you do cross-country running or skiing, you will see flags tied to trees, or painted posts sticking out of the ground. These are marks that tell the runners what the path is that they should follow. It is assumed that a runner or a skier will follow along the track marked with these flags, and will not stray, because from each flag, he runs to the next one. Path_corner entities are like these flags, and the func_train is your runner. The func_train will always start at its first designated path_corner, and from there, it will move along the path established by the positioning of the consecutive path_corner entities. It will move from one path_corner to the next in a straight line, so with good positioning, you can form either curved or angular "tracks" for your func_train to follow. Let's see how this is done!
First of all, you need your func_train brush(es). What are they? Well that depends on what structure you want to move in your level. This can be a door, an elevator, a train, or just a moving platform. After you create this structure, click the toEntity button, and make the class func_train. Look, it has a name attribute! We all know what that means, it can be triggered! The next important attribute is First stop target. This is where we start getting into path_corner entities. You need to create at least one path_corner entity and give it a name. Then, put that name in the first stop target attribute field. This is where your train will not only start, but have a location in space. The first stop path_corner's center is where the func_train's center will be when you first start the level. This is very important to understand: the starting position of your func_train is not where it's located in your level at compile time, it'll be located where the first stop path_corner is. The attributes for the path_corner entities are very self explanatory, but not all of them apply to the func_train entity. For example, new train_rot speed does not apply in this case, you will learn more about this in upcoming func_tracktrain tutorials. If the wait for retrigger flag is checked, then the train will stop at that path_corner and wait until it's triggered again.
There are a few restrictions associated with func_trains. For example, as you can see in my example map, they cannot rotate or pivot. Also, you can't get a light to move along with your train, so if you plan on having your train move through some dark areas, I suggest you use texture-based lighting on the train brushes. Keep in mind that doing this will not make the train textures change shading as it moves along the track. Being an entity, your train will always have one shading. You can, however, control this static shading. The most common (and quite useful) method is creating a simple rectangular room someplace apart from your level. Then, create all of the func_train brushes in that room and set the entity properties. Then, put in some light entities or light-emanating textures to shade your train. The train brush will compile in this isolated room, but as I mentioned in the beginning, the train will materialize at its first path_corner entity. As a result, you will still have a train with static shading, but you will have some pretty flexible control over this lighting. Another restriction is that you can't have the player control the speed of the train like you have seen in the game. This can only be done with func_tracktrain entities,
|