In this tutorial, I will show you how to make a train in cs. Keep in mind that the train does not work on a single entity; in fact, it constitutes of a group of entities. Therefore, it can be called an entity system.
A little information
You can not only make trains but also elevators, cranes, moving platforms, etc. I will simply explain the concept of making the train here. Also, you should be well versed in the type of entities in goldsrc. If you can't understand the entities system shown here, go to this tutorial.
Step 1
Make a simple brush about 64x64x16 units. You can make any type of brush but make something small and simple for the first time. Now place cube on top of the brush. Keep in mind that it should be in the center of the brush and it must be fully covered in the "origin" texture.
Done?
Now select both the cube and the brush and tie it to the func_tracktrain entity. Keep in mind that the brush covered in the origin texture will not show up in game. This brush tells the goldsrc engine the center of the train. So if you make train and place the origin covered brush on the front, the train will take turns from the front, thereby simulating 2x2 drive which is found in vehicles.
Step 2
Now setup the properties of this entity.
Name: Type something unique like train1. This is used to ink the func_traincontrols entity.
Invisible: no(obviously)
Non solid: no
First stop target: Type something which can be written in progression like r1 or t1. This targets the entity the train will teleport to first when the round starts.
Sound: Some sounds are given to select, choose one.
Distance between the wheels: ignore this property for now.
Height above track: Ignore this one also.
Initial speed: Leave it at default.
Speed: add some number around 500.
Damage on crush: 0 does not hurt the player when he blocks the train on its path but add a number to make the player take damage upon blocking the trains path.
Volume: Control the noise the train makes.
Bank angle on turns: This useful property makes the train automatically tilt when it turns. Add a small value like 4 or 8 for now. Angles are measured in degrees.
Flags:( no need to mess with these for now)
No pitch. Disables the train to automatically tilt forwards or backwards between two turns which are located at an uneven height.
No user control: Disables the user control. Useful if you want to make a train which runs automatically. Keep in mind that you still need to add a name for the train as you will make to manually trigger the train by another entity.
Passable: Makes the train pass through players without blocking them.
For this tutorial, I have named the first stop target as t1. Now place the point based path_track entity in front of the train. Name the path_track entity as t1. Type t2 as the next stop target.
What does this mean?
It means that the train will follow a set of set of entities. Just keep placing the path_track entities and name them in succession like t1>t2>t3, etc. To make the train go in a loop, type t1 in the last path_track's next stop target.
Step3
Now you need to make the controls for the player. Create a box on top of our platform. Texture this brush in the aaa texture and convert it into the func_traincontrols entity. When the player enters the box, he will be able to control the train.
But what if you want the train to be controlled from another position? Like a control panel or any other entity.
Just place a trigger_multiple or a func_button entity and type the name of the train in its target name.
See this screenshot.
The number on the left is in the name field and the number on the right is the target field. Both of them constitute a path_track entity.
That's it. You have successfully made a moving platform which goes from one point to another. However, there a lot of different entities to experiment.
Notes
Func_train and func_tracktrain are basically same. Just remember that the func_train entity is useful for making elevators while the tracktrain is useful for making actual trains.
Keep in mind that the func_tracktrain will not work with the path_corner entity. That will only work with the func_train entity.
Ducking while in a moving train or any other moving entity will cause the train to stop moving when it comes in contact with a solid brush.
A little information
You can not only make trains but also elevators, cranes, moving platforms, etc. I will simply explain the concept of making the train here. Also, you should be well versed in the type of entities in goldsrc. If you can't understand the entities system shown here, go to this tutorial.
Step 1
Make a simple brush about 64x64x16 units. You can make any type of brush but make something small and simple for the first time. Now place cube on top of the brush. Keep in mind that it should be in the center of the brush and it must be fully covered in the "origin" texture.
Done?
Now select both the cube and the brush and tie it to the func_tracktrain entity. Keep in mind that the brush covered in the origin texture will not show up in game. This brush tells the goldsrc engine the center of the train. So if you make train and place the origin covered brush on the front, the train will take turns from the front, thereby simulating 2x2 drive which is found in vehicles.
Step 2
Now setup the properties of this entity.
Name: Type something unique like train1. This is used to ink the func_traincontrols entity.
Invisible: no(obviously)
Non solid: no
First stop target: Type something which can be written in progression like r1 or t1. This targets the entity the train will teleport to first when the round starts.
Sound: Some sounds are given to select, choose one.
Distance between the wheels: ignore this property for now.
Height above track: Ignore this one also.
Initial speed: Leave it at default.
Speed: add some number around 500.
Damage on crush: 0 does not hurt the player when he blocks the train on its path but add a number to make the player take damage upon blocking the trains path.
Volume: Control the noise the train makes.
Bank angle on turns: This useful property makes the train automatically tilt when it turns. Add a small value like 4 or 8 for now. Angles are measured in degrees.
Flags:( no need to mess with these for now)
No pitch. Disables the train to automatically tilt forwards or backwards between two turns which are located at an uneven height.
No user control: Disables the user control. Useful if you want to make a train which runs automatically. Keep in mind that you still need to add a name for the train as you will make to manually trigger the train by another entity.
Passable: Makes the train pass through players without blocking them.
For this tutorial, I have named the first stop target as t1. Now place the point based path_track entity in front of the train. Name the path_track entity as t1. Type t2 as the next stop target.
What does this mean?
It means that the train will follow a set of set of entities. Just keep placing the path_track entities and name them in succession like t1>t2>t3, etc. To make the train go in a loop, type t1 in the last path_track's next stop target.
Step3
Now you need to make the controls for the player. Create a box on top of our platform. Texture this brush in the aaa texture and convert it into the func_traincontrols entity. When the player enters the box, he will be able to control the train.
But what if you want the train to be controlled from another position? Like a control panel or any other entity.
Just place a trigger_multiple or a func_button entity and type the name of the train in its target name.
See this screenshot.
The number on the left is in the name field and the number on the right is the target field. Both of them constitute a path_track entity.
That's it. You have successfully made a moving platform which goes from one point to another. However, there a lot of different entities to experiment.
Notes
Func_train and func_tracktrain are basically same. Just remember that the func_train entity is useful for making elevators while the tracktrain is useful for making actual trains.
Keep in mind that the func_tracktrain will not work with the path_corner entity. That will only work with the func_train entity.
Ducking while in a moving train or any other moving entity will cause the train to stop moving when it comes in contact with a solid brush.
No comments:
Post a Comment
Post your views here