Chapter XVII. Vehicles, Elevators, Platforms.

Moving vehicles, elevators, and platform mechanisms.

17.1

Creating a Vehicle

In this article we will explain how machines are created. We will need the following entity objects: Cars appeared in CS not so long ago, then the map de_jeepathon2k was added to the official mappack, which quickly disappeared from there due to numerous glitches associated with cars. So don't be surprised if your car falls through the ground or, on the contrary, hangs at a height of 5 m.
In the picture below you can see what the cars will look like on our test map:
This is what the cars will look like on the test map
The car itself is a brush entity object func_vehicle, which must necessarily include ORIGIN brush (since a car is a rotating object). First we define the shape of the car with several brushes, then we create ORIGIN brush and turn it all into func_vehicle. Of course, it is not necessary to give the car the shape of a car. You can make a board, a box, and a barrel ride.
After this, it is necessary to create a zone from which the player will control the car. This zone is defined by the brush entity object func_vehiclecontrols, which must be painted over with texture on all sides AAAtrigger. The control area does not need to be part of the vehicle; it is simply located around the vehicle's cabin.
Using the func_vehiclecontrols object we define the vehicle control zone
Well, and lastly, you need to make two point entities path_track, which determine the initial direction of the car (i.e. in which direction it will be deployed).
Create 2 path_track point objects (one under the car, the other a little to the side)
IMPORTANT: When creating a car, it must be oriented in the top view with the cabin to the left (as intended by the developers) so that the game can determine where the front of the car is.
In the game the car will appear at the first object path_track and will be directed to the second object path_track. Thus, it is not at all necessary to place the car exactly in the place where it should appear in the game. The car will appear at the first object path_track.

About ORIGIN brush in cars

The ORIGIN brush must be placed in the center of the car, the car will rotate around it. The size of the ORIGIN brush does not matter; the position of its center is more important, because the location of the car along the vertical axis relative to the road depends on it. It may turn out that the car will appear suspended in the air or buried in the ground. In this case, it is necessary to adjust the "Height above track" parameter (i.e., the height above the ground).
To correctly determine the value of the "Height above track" parameter, you need to calculate the distance from the center in the editor on the 2D side view ORIGIN brush to the top of the object path_track (see picture below).
t19auto4 This distance must be recorded in the "Height above track" parameter of the func_vehicle.
Well, and finally, before we present the properties of all the objects involved, it is necessary to add that the composition of the machine (object func_vehicle) can be included CLIP brushes to block the player's movements. For example, you don't want players to be able to climb into the back of a car - create CLIP brush and then create with it func_vehicle.
If something doesn't work out for you with the machines, download an example map and figure it out yourself.
Func_vehicle (vehicle)
Name: car1 (car name, required)
First stop target: path1 (name of the first path_track object)
Sound: 2 (sound made when the car is moving)
Length of the vehicle: 150 (vehicle length in units, we recommend setting the value 8-16 units lower for ease of control)
Width of the vehicle: 90 (vehicle width in units, it is also better to reduce by 8-16 units)
Height above track: 8 (the height of the car above the road, determined as written above)
Initial speed: 0 (initial speed of the car, with a value > 0, the car will move itself at the beginning of the round)
Speed: 550 (maximum vehicle speed, units per second)
Damage on crush: 0 (amount of percentage of life taken from the player when hit by a car
Volume (10 = Loudest): 7 (sound volume, values ​​from 0 to 10, where 10 is the maximum volume)
Bank angle on turns:0 (tilt angle of the car in turns)
Flags:
No Pitch (X-rot) — if checked, the car will only rotate around the vertical Z axis
No User Control — if checked, the player will not be able to control the car
Passable — if checked, then the car will be intangible, i.e. it will be possible to pass through it
Func_vehiclecontrols (vehicle control zone)
Vehicle name: car1 (name of the car the player will drive)
Path_track (defines the starting position of the car)
Name: path1
Next stop target: path2 (enter the name of the second path_track object here)
There is no need to set any other parameters.
Path_track (defines the starting direction of the car)
Name: path2
Next stop target: path1 (enter the name of the first path_track object here)
There is no need to set any other parameters.
func_vehicle.zip [110Kb] - in the archive there is an example map in BSP and RMF formats.
17.2

Simple Lift (Elevator)

In this article we will talk about how you can make an elevator that will travel between two floors and be called by buttons. There is a similar elevator on the map CS_SIEGE. To create an elevator we will need the following entity objects: Determining the shape of the elevator. Let's turn it into func_door. In order for the elevator to move up and down, the "Angle" parameter must be set to "Up". It is also important to set the "Delay before close: -1" parameter so that the elevator remains on the new floor and does not automatically return to its original position.
You also need to create a button on each of the two floors (func_button), which will set the elevator in motion after a few seconds.
Elevator device
Func_door (elevator)
Angle: Up (direction of movement, up-down)
Name: elevator (name for the elevator)
Speed: 120 (elevator speed, units per second)
Move sound: large rollers (motion sound)
Stop sound: ratchet stop (stop sound)
Delay before close: -1 (with this value the elevator will wait on the new floor until the next call)
Lip: -180 (additional distance the elevator will travel, see below)
Flags:
Don't link
Toggle: the elevator will wait for the next activation and will not automatically return back
One of the most important parameters of the elevator is "Lip", which is used to change the distance the elevator travels.
The fact is that by default the elevator rises to the distance of its height. For example, our elevator height is 120 units. By default, it will rise exactly this distance. The distance between two floors is 300 units. This means that the elevator will not reach the second floor and will be "stuck" between floors. In this regard, the distance over which the elevator moves needs to be increased. This is exactly what the "Lip" parameter allows you to do. Moreover, a negative value of the "Lip" parameter increases the distance, and a positive value shortens it.
In the diagram below, the elevator is shown in the bottom position (on the first floor).
Less contrasting colors show its position with the value "Lip=0".
The dotted line shows the position of the elevator in its final position (on the second floor).
t24elevator2 Dimensional lines show what distance is considered "Lip". For us, this distance was 180 units, therefore, we must write the value -180 in the "Lip" parameter.
As mentioned above, you need to create one button on each floor func_button, which will launch the elevator. The properties of these buttons look like this:
Func_button (button that starts the elevator)
Target: elevator (here we wrote down the name of the elevator)
Delay before trigger: 2 (time before elevator activation)
Delay before reset: 1 (time during which the button cannot be activated again)
Flags:
Don't move: the button does not press into the wall when pressed
elevator.zip [25Kb] - in the archive there is an example map in BSP and RMF formats.
17.3

Platforms

In this article you will learn how to create simple rising platforms, as well as platforms that rise while simultaneously rotating around an axis. We will use the following entities:

1. Simple platform

All you need to know to create a simple rising platform is that it should be placed in the top position, i.e. where the platform should arrive. This is somewhat inconvenient, but what can you do - this is the condition.
Look at the picture below, where the platforms are placed in their final position. They will bring the player to this place and stop.
Platforms should be placed at the top position (the end point of the path)
In the game, the platforms, as expected, will be located at the bottom. You may ask: why are not all platforms on the ground, but only platform #4?
The answer is very simple. It's all about properties (see below).
In the game, the platforms will be, as expected, from below (at the starting point of the path)
Properties:
Travel altitude (can be negative) — the distance in units that the platform rises to
Speed — platform movement speed, units per second
Flags:
Toggle - if checked and the platform is activated by a button or trigger, then once raised, it will not lower automatically. To lower the platform, it will need to be reactivated
The main parameter in the properties is Travel altitude, which determines the distance the platform will rise. Note that the distance can also be negative, in which case the platform will move in the opposite direction.
Unfortunately, sometimes when you specify a negative distance, the map does not start and an error is displayed: "backwards mins/maxs" - depending on your luck.
As for our test map, we created 4 platforms on it with absolutely identical properties (same speed and same lifting distance). First, the player jumps from the ground to platform number 4, it takes him to the level of platform #3, then the player jumps to #3, it rises to the level of platform #2, etc.

2. Rotating platform

Our rotating platform will look like this:
We create a rotating platform, not forgetting about the ORIGIN brush in its center
At the bottom of the platform, as you can see, we created an orange pillar on which it supposedly rises, and also in the center we placed ORIGIN brush, because rotating platform.
After the platform is created, select it along with the ORIGIN brush and turn it into func_platrot.
The center of the ORIGIN brush coincides with the center of the platform
We placed the platform at the final (upper) point of the route. The player will stand on a platform on the ground and it will begin to rise and rotate at the same time.
Properties:
Speed of rotation — rotation speed around the axis (degrees per second)
Spin amount — rotation angle in degrees (for example, 1440° is 4 revolutions around an axis)
Travel altitude (can be negative) — the distance in units that the platform rises to
Flags:
Toggle - as in the previous case
X Axis or Y Axis — choice of rotation axis
In our case, the platform rotates around the vertical Z axis, so the flags X Axis or Y Axis should not be displayed. However, if we need rotation around the X or Y axes, then we will need to check the appropriate flag.
func_plat.zip [29Kb] - in the archive there is an example map in BSP and RMF formats.