- Game configuration file that supports vehicle entities such as this one
- Understanding of 3D space and dimensions
2. Creating an origin for the vehicleThe game considers the front of the vehicle to face the negative X-axis in the editor, and therefore should be created with this in mind. You can change the in-game orientation of your vehicle later. The axes should be visible as red, blue, and green lines, where Z is up in the editor.
Create a brush textured with ORIGIN at the exact center of your vehicle on the X and Y-axes. This will let you properly determine the length and width of the vehicle's collision box. You can use the brush selection handles as a reference for where the center of your vehicle is. The brush doesn't have to be centered on the Z-axis.
3. Creating the vehicle entityYou must select all the brushes of your vehicle, including the ORIGIN brush, and assign them to a
The vehicle controls need to target this entity, so set a unique name.
Name of the
path_trackentity the vehicle will spawn at in-game.
The dimension of the vehicle, in units, on the X-axis.
The dimension of the vehicle, in units, on the Y-axis.
This defines how many units the bottom of the ORIGIN brush is above ground. This is useful if your vehicle has wheels, is a boat, or a helicopter. While making the origin touch the ground and setting this to 0 will work, it is not an ideal solution due to the way vehicles collide with the world.
This defines how many degrees the vehicle tilts when turning. This is good for motorcycles.
Damage dealt to players who get run over or otherwise block the movement of the vehicle.
The speed of the vehicle, in units per second.
The velocity of the vehicle as soon as the level loads in-game. The vehicle will immediately decelerate to a stop.
The type of sound the engine. This must be an integer ranging from 1 to 7. You can find the vehicle sounds in ../cstrike/sound/plats/
The volume of the engine. This must be an integer ranging from 1 to 10.
4. Creating tracks for the vehicle
You must create two of these entities. The first
path_trackserves as a spawning point for the vehicle and therefore must be targeted by it. The first
path_trackmust also target the second
path_track. The second one must, in turn, target the first. The front of the vehicle will face the second
4.1. Sven Co-opUnlike in Counter-Strike, the second
path_trackused to change the vehicle's orientation should not target the first one, or else the vehicle flips on the wrong axis entirely.
5. Creating vehicle controls
Create a brush wherever you want and assign it to a
func_vehiclecontrolsentity. Make the vehicle controls target the vehicle and you will be able to drive it with E.
6. Sven Co-op scriptingThe current version of Sven Co-op has a
func_vehicle_customAngelscript in ../svencoop/scripts/maps/. You must include it in your own map's script for it to work. Copy the following code and save it with the .as file extension to /svencoop/scripts/maps/.
VehicleMapInit( true, true );
If you create your own folder to organize your scripts, you can try the following to go up a directory instead:
You must also create a configuration file for your map to run the script. Copy the following cvar and save it with the .cfg file extension to ../svencoop/maps/. The config file should have the same filename as your map.