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



Introduced in

Version:1.31

Description

Description:

Locks a vehicle turret to a specific azimuth and elevation relative to the vehicle hull. While locked, the turret is no longer able to move or have its gunner engage targets (while still being able to fire).

Syntax

Syntax:[vehicle, turret, azimuth, elevation, smooth] call fn_vbs_lockTurretDir
Parameters:
  • vehicle: Object - Vehicle the turret is on.
  • turret: Array - Turret path.
  • azimuth: Number - Direction relative to vehicle hull.
  • elevation: Number - Elevation above horizontal.
  • smooth: Boolean - If true, the turret smoothly rotates into position before locking. If false, the turret instantly moves into position (optional, default: true).
Return Value:Nothing

Alternative Syntax

Syntax:[vehicle, turret] call fn_vbs_lockTurretDir
Parameters:
  • vehicle: Object - Vehicle the turret is on.
  • turret: Array - Turret path.
Return Value:Nothing

Warning

When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.

Examples

Examples:
[_veh, [0], 180, 10] call fn_vbs_lockTurretDir; // Lock turret to vehicle 6 o'clock
sleep 60;
[_veh, [0]] call fn_vbs_lockTurretDir // Unlock the turret

Additional Information

See also: turretLockedOn, setWeaponDirection, setFireArc
Multiplayer: 
Problems:This function is not meant to be be called every frame. It depends on time delays and spawned looping scripts every time it is called. If you need per-frame control over a turret, use setWeaponDirection instead, combined with some math to convert from relative to absolute elevations.

Notes