Vehicle Scripting: Basic Overview
From Mod Wiki
This article gives a basic overview of the relationship between the entityDef, vehicleDef and script used to define the vehicle.
There are three major parts to a vehicle's configuration:
The vehicle definition is generally stored in a .vscript file in the base/vehicles directory. This defines much of the configuration of the vehicle:
- Physical characteristics
- Wheels & suspension
- Player positions
- Associated weapons
- Camera views
- Inverse Kinematics (IK)
This C++/Java like script controls the behaviour of the vehicle in various situations, and is generally stored in the base/script/vehicles directory. These can be used to add complex scripted behaviours to the vehicle, for example the MCP. There is a base vehicle script that the other vehicles derive from. The base script contains most of the behaviour needed, for example creating the damage effects. The vehicle-specific scripts do things like configuring weapon selection.
This definition links all the definitions together into one name that can be spawned in the game. entityDefs for vehicles generally live in base/def/vehicles.
These are just some of the many things that are configured in a vehicle's entity definition:
- Vehicle definition
- Control style & context
- Visual model