Arma 3 Scripting

Vehicle Respawn

Topic · Markdown · JSON · original wiki page

Arma 3 v2.18

Arma 3 v2.18 improved and extended the vehicle respawn functionality. The new options can be found on respawnVehicle and getRespawnVehicleInfo pages.

Description.ext

Important

Any mode set for vehicle that is invalid (e.g 4/"GROUP") will be treated as 0/"NONE".

Respawn Type Available To
Number String Character Vehicle
0 "NONE" ✓ ✓
1 "BIRD" ✓ ✗
2 "INSTANT" ✓ ✓
3 "BASE" ✓ ✓
4 "GROUP" ✓ ✗
5 "SIDE" ✓ ✗

The 'respawn' mode parameter is applied to both units and vehicles. Since Arma 3 v2.18 there is a new respawnVehicle parameter that can set individual respawn mode for vehicles:

Before Arma 3 v2.18 Since Arma 3 v2.18
respawn = 3;                // sets respawn mode for units and vehicles
respawnDelay = 8;            // sets respawn delay for units

respawnVehicleDelay = 30;    // sets respawn delay for vehicles
respawn = 3;                // sets respawn mode for units
respawnDelay = 8;            // sets respawn delay for units
// if 'respawnVehicle' is not set, 'respawn' is used for vehicles
respawnVehicle = 2;            // sets respawn mode for vehicles
respawnVehicleDelay = 30;    // sets respawn delay for vehicles

3den Editor

There are 6 respawn options in the 3DEN in Multiplayer options:

This option is mirroring 'respawn' from description.ext. Only Disabled, Respawn on Custom Position and Resapwn on Position Of Death apply to vehicles. There is no separate option for individual vehicle respawn mode, which is currently available in description.ext and via script command only.

Other parameters are:

The description.ext respawn params take priority over 3DEN respawn params.

Script

The vehicle respawn params can be set via respawnVehicle and read via getRespawnVehicleInfo. The script commands also provide additional options not available otherwise.

In addition to setting respawn mode and delay, it is possible to set:

The vehicle respawn is handled at the client where vehicle was destroyed. If client leaves the server, the vehicle respawn will be transferred to the server. Vehicle placed in editor will also spawn on the server for the very first time.

respawnVehicle now has an option to force vehicle respawn on the server regardless, which should make it easier to use respawnVehicle command as it requires vehicle to be local. When vehicle respawn is "BASE", the moment a vehicle is destroyed, a respawn marker for it is chosen, which could be returned with getRespawnVehicleInfo. This is the process of selecting such marker:

  1. vehicle specific side specific: search for all markers that prefix with "respawn_<vehicleVarName>_<side>", for example "respawn_car1_west_1". If several are found, a random one is chosen
  2. vehicle specific: search for all markers that prefix with "respawn_<vehicleVarName>", for example "respawn_car1_123". If several are found, a random one is chosen
  3. vehicle general side specific: search for all markers that prefix with "respawn_vehicle_<side>", for example "respawn_vehicle_east_FOREST". If several are found, a random one is chosen
  4. vehicle general: search for all markers that prefix with "respawn_vehicle", for example "respawn_vehicle_garage". If several are found, a random one is chosen
  5. any respawn marker: search for all markers that prefix with "respawn", for example "respawn_left1". If several are found, a random one is chosen
  6. if no markers found, the wreck position and direction is used.

When a marker is found, the respawn position is chosen randomly within the marker. If the marker is Icon, or the size of the marker is 0, the position is marker position. If the marker is Ellipse or Rectangular, the position is chosed randomly within its area. Vehicle direction is chosen randomly unless specified to take direction of the marker with respawnVehicle. Alternatively, the respawn position can be passed as return value in the vehicle's Respawn event handler. By default all vehicles are respawned on the ground even if position's height is above the ground. respawnVehicle has an option to respawn in the air.

Many respawn params can be ajusted on the fly while the vehicle is in respawn queue, but the vehicle has to be local for this to have an effect.

Vehicle specific side specific marker could be used to have the same named vehicle spawn on enemy or friendly side, depending on the respawn side param set with respawnVehicle command. If there are 2 markers "respawn_car1_west", "respawn_car1_east", car1 will respawn on the marker that matches respawn side set after vehicle entered into repsawn queue. For example one could make a scenario where enemy vehicles could get commandeered and on the next respawn appear on friendly side.