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:

Vehicle Definition

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
    • Size
    • Shape
    • Wheels & suspension
    • Boosters
    • etc..
  • Player positions
    • Positioning
    • 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.

Entity Definition

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
  • Script
  • Control style & context
  • Health
  • Visual model
  • Sounds
  • Effects