Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduced in

Version:1.00

Description

Description:

Remove a weapon from a unit or vehicle.

Note: It is possible to create invalid combinations with this command (for example, attempt to remove a weapon that the unit does not possess). In the event of an invalid combination, the command behavior is undefined.

Syntax

Syntax:unit removeWeapon weaponName
Parameters:
  • unit: Object - Unit or vehicle without turrets.
  • weaponName: String - Class name (see Weapon Configuration in the VBS3 Developer Reference) of the weapon.
Return Value:Nothing

Alternative Syntax

Syntax:unit removeWeapon [weaponName, turret] (VBS3 1.60+, not available in VBS3 2.x+, functional again in VBS3 22.1+ and is ported to VBS4 20.1.2 and VBS4 21.1)
Parameters:
  • unit: Object - Vehicle with turrets.
  • weaponName: String - Class name (see Weapon Configuration in the VBS3 Developer Reference) of the weapon.
  • turret: Array - Turret to remove the weapon from.
Return Value:Nothing

Alternative Syntax #2

Syntax:unit removeWeapon weaponObject (VBS3 3.9+)
Parameters:
  • unit: Object - Vehicle with turrets.
  • weaponObject: Object - Object of the weapon to remove.
Return Value:Nothing

Examples

Examples:
player removeWeapon "M16"car removeWeapon ["vbs2_carhorn",[]]

// Name your vehicle (for example, m1a1)
listallTurrets m1a1  // m1a1: Object - Vehicle with turrets (shows all the turrets on a vehicle - for example, [[0],[0,0],[0,1]])

// Pick one of the turrets
m1a1 weaponsTurret [0]   // Shows all the weapons on a turret)

m1a1 removeWeapon ["vbs2_m256_120mm",[0]]

Additional Information

See also: addWeapon, removeAllWeapons, removeMagazines
Multiplayer:
Problems:

Notes