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

Introduced in

Version:1.00

Description

Description:Adds a weapon to a unit or vehicle. While it is possible to add a weapon to an initially unarmed vehicle, due to the fact that none of the required memory points exist in the vehicle, it makes aiming impossible, and firing it is likely to damage the vehicle itself. To ensure that the weapon is loaded at the start of a mission, at least one magazine should be added (see addMagazine), before adding the weapon.

Syntax

Syntax:unit addWeapon weapon
Parameters:
  • unit: Object - The unit to add the weapon to.
  • weapon: String - The class name of the weapon to add.
Return Value:Nothing

Alternative Syntax

Syntax:vehicle addWeapon [weapon,turret] (V1.60+)
Parameters:
  • vehicle: Object - The vehicle to add the weapon to.
  • weapon: String - The class name of the weapon to add.
  • turret: Array - The turret to add the weapon to.
Return Value:Nothing

Alternative Syntax #2

Syntax:unit addWeapon weapon (V3.9+)
Parameters:
  • unit: Object - The unit to add the weapon to.
  • weapon: Object - The weapon to copy.
Return Value:Object - If the command succeeds, a copied weapon game object is returned. Otherwise, a null-object is returned.

Examples

Examples:
player addWeapon "M16"
car1 addWeapon ["vbs2_2a18_122mm",[]]
_copiedWeapon = player addWeapon _newWeapon

Additional Information

See also: removeWeapon, removeAllWeapons, addMagazine
Multiplayer:
Problems:

Notes