currentWeaponMode: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - "‎" to "")
Line 27: Line 27:
|x2= <sqf>_weaponMode = currentWeaponMode gunner vehicle player;</sqf>
|x2= <sqf>_weaponMode = currentWeaponMode gunner vehicle player;</sqf>


|seealso= [[ArmA:_Actions#SWITCHWEAPON|SWITCHWEAPON]] [[currentWeapon]]
|seealso= [[ArmA:_Actions#SWITCHWEAPON|SWITCHWEAPON]] [[currentWeapon]]
}}
}}



Revision as of 12:54, 26 April 2023

Hover & click on the images for description

Description

Description:
Returns current weapon mode of unit's weapon. Result can be: "Single", "Burst", "FullAuto", "manual", "player"
This command will return 0 Number if given object is a vehicle instead of a person.
You can alternatively use
Groups:
Weapons

Syntax

Syntax:
currentWeaponMode gunner
Parameters:
gunner: Object
Return Value:
String

Examples

Example 1:
_weaponMode = currentWeaponMode player;
Example 2:
_weaponMode = currentWeaponMode gunner vehicle player;

Additional Information

See also:
SWITCHWEAPON currentWeapon

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note


Posted on September 27, 2014 - 18:20 (UTC)
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.
Sarogahtyp - c
Posted on Jul 04, 2022 - 12:48 (UTC)
To set the firemode of the current weapon of a player, simply use the workaround described by Killzone_Kid in the first note of the forceWeaponFire wiki entry:
_weapon = currentWeapon player; _ammo = player ammo _weapon; player setAmmo [_weapon, 0]; player forceWeaponFire [_weapon, "FullAuto"]; player setAmmo [_weapon, _ammo];