Arma 3 Scripting

Command in Unit Inventory

primaryWeapon

Also available as Markdown and JSON, or read the original wiki page.

Description

Returns name of unit's primary weapon. This command will also return a weapon class name if the weapon is not used by the player, for example, it is on the unit's back. Use currentWeapon to get the weapon the unit is using.

Syntax

primaryWeapon unit

Parameters:

Returns: String - weapon class name or "" if no primary weapon

Examples

Example 1

_pWeap = primaryWeapon player;

Example 2

hint primaryWeapon player; // "arifle_MX_ACO_pointer_F"

See also

primaryWeaponMagazine · primaryWeaponItems · addPrimaryWeaponItem · removePrimaryWeaponItem · removeAllPrimaryWeaponItems · secondaryWeapon · handgunWeapon · currentWeapon · weapons