Page tree
Skip to end of metadata
Go to start of metadata


Introduced in

Version:3.4

Description

Description:

Applies the direction of a master vehicle (driver or turret) to a slave turret.

Note: The vehicle of the slave turret does not have to be crewed. 

Syntax

Syntax:[master, source] setTurretMaster [slave, turret, freeLook, priority]
Parameters:
  • master: Object - Vehicle whose direction should be matched (empty to cancel matching).
  • source: String or Array - Position in master vehicle to match. Either "driver" or a turret path. If source is a turret, or the freeLook option is enabled, then the vertical direction is matched as well (within the limitations of the slave turret) (empty to cancel matching).
  • slave: Object - Vehicle (with turret) that should match the source direction.
  • turret: Array - Turret to which apply the source direction.
  • freeLook: Boolean - If true, then the source free-look direction is used.
  • priority: Number - If multiple sources are defined, then the one with the highest priority is used (optional, default: 0).
Return Value:Nothing

Examples

Examples:
Apply the direction of tank1 driver to that of its main turret:
[tank1,"driver"] setTurretMaster [tank1,[0],false];

Apply the view direction of tank1's main turret to that of tank2:
[tank1,[0]] setTurretMaster [tank2,[0],true];

Reset tank2's direction matching:
[] setTurretMaster [tank2,[0]];

Additional Information

See also: getTurretMaster, turretWeaponDirection, setOpticsDirection, changeTurretDirection
Multiplayer:
Problems:
  • If source is set to "driver", then no matter what the freeLook option is set to, the slave follows the player view.
  • If source is set to "driver", then the command only interprets the initial vehicle assignment, but if positions change, this is not taken into consideration.
  • If source is the driver of a vehicle (occupied by a player), and the player then opens the RTE, the editor view is matched by the slave turret.
  • The master direction is interpreted differently, depending on whether it is a driver or a turret.
    For a driver, the vehicle absolute direction is used (for example, a car points at 270 degrees, then the slave turret points at 270 degrees as well).
    For a turret, the direction is relative to its vehicle (for example, a vehicle and turret pointing at 270 degrees translates into a slave turret direction of 0 degrees, or vehicle pointing at 270 degrees, and the turret pointing at 315 degrees causes the slave turret to point at 45 degrees).

Notes