Arma 3 Scripting

currentWeaponMode

  • Arma 3 v0.50
  • First in Arma 2: Operation Arrowhead v1.50

Command · Markdown · JSON · original wiki page

Description

Returns current weapon mode of unit's weapon.

Warning

This command will return 0 Number if given object is a vehicle instead of a person.
You can alternatively use

_muzzle = weaponState player select 2;

Syntax

currentWeaponMode gunner

Parameters:

Returns: String - current mode's classname

Examples

Example 1

_weaponMode = currentWeaponMode player;

Example 2

_weaponMode = currentWeaponMode gunner vehicle player;

See also

ArmA: Actions · currentWeapon

Community notes

Pierre MGI

  • Be careful using this in script. This function returns these strings but also:
    - 0 if unit is in a vehicle (pax),
    - absolutely nothing if AH-99 helo driver or all weapons removed,
    - "truckhorn2" if Hunter driver...
    Absolutely nothing means: if you use a hint to display the returned value, you obtain absolutely no text,no black box, no error! Hint isn't displayed and there is no error in rpt file with compile preprocessFileLineNumbers.

On the other hand, returned value 0 when unit is pax of a vehicle, could lead to a variable error type if your script is waiting for a string.