currentWeaponMode: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (For the love of Zeus, please use proper note formatting Pierre!)
m (Text replacement - "<sqf>([^↵][^\/]*↵[^\/]*)<\/sqf>" to "<sqf> $1 </sqf>")
 
(59 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma2oa |= Game name
|game1= arma2oa
|version1= 1.50


|1.51|= Game version
|game2= tkoh
____________________________________________________________________________________________
|version2= 1.00


| Returns current weapon mode of unit's weapon. Result can be: "Single", "Burst", "FullAuto", "manual", "player" |= Description
|game3= arma3
____________________________________________________________________________________________
|version3= 0.50


| '''currentWeaponMode''' gunner |= Syntax
|gr1= Weapons


|p1= gunner: [[Object]] |=  
|descr= Returns current weapon mode of unit's weapon.


| [[String]] |= Return value
{{Feature|warning|This command will return 0 [[Number]] if given object is a vehicle instead of a person.<br>
____________________________________________________________________________________________
You can alternatively use <sqf>_muzzle = weaponState player select 2;</sqf>}}


|x1= <code> _weaponMode = [[currentWeaponMode]] [[player]];</code> |=
|s1= [[currentWeaponMode]] gunner
|x2= <code> _weaponMode = [[currentWeaponMode]] [[gunner]] [[vehicle]] [[player]];</code> |=
____________________________________________________________________________________________


| [[ArmA:_Actions#SWITCHWEAPON]], [[currentWeapon]] |= See also
|p1= gunner: [[Object]]
}}
 
|r1= [[String]] - current mode's classname


<h3 style="display:none">Notes</h3>
|x1= <sqf>_weaponMode = currentWeaponMode player;</sqf>
<dl class="command_description">
<!-- Note Section BEGIN -->


<!-- Note Section END -->
|x2= <sqf>_weaponMode = currentWeaponMode gunner vehicle player;</sqf>
</dl>


<h3 style="display:none">Bottom Section</h3>
|seealso= [[ArmA:_Actions#SWITCHWEAPON|SWITCHWEAPON]] [[currentWeapon]]
}}


[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:ArmA 2 OA: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]


<!-- CONTINUE Notes -->
<dl class="command_description">
<dl class="command_description">
<dd class="notedate">Posted on September 27, 2014 - 18:20 (UTC)</dd>
 
<dt></dt>
<dd class="notedate">Posted on 2014-09-27 - 18:20 (UTC)</dd>
<dt class="note">[[User:Pierre MGI|Pierre MGI]]</dt>
<dt class="note">[[User:Pierre MGI|Pierre MGI]]</dt>
<dd class="note">
<dd class="note">
- Be careful using this in script. This function returns these strings but also:
- Be careful using this in script. This function returns these strings but also:<br>
- 0 if unit is in a vehicle (pax),
- 0 if unit is in a vehicle (pax),<br>
- absolutely nothing if AH-99 helo driver or all weapons removed,
- absolutely nothing if AH-99 helo driver or all weapons removed,<br>
- "truckhorn2" if Hunter driver...
- "truckhorn2" if Hunter driver...<br>
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.
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.
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.
</dd>
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->
 
{{Note
|user= Sarogahtyp
|timestamp= 20220704124833
|text= To set the firemode of the current weapon of a player, simply use the workaround described by [[User:Killzone_Kid|Killzone_Kid]] in the first note of the [[forceWeaponFire]] wiki entry:
 
<sqf>
_weapon = currentWeapon player;
_ammo = player ammo _weapon;
player setAmmo [_weapon, 0];
player forceWeaponFire [_weapon, "FullAuto"];
player setAmmo [_weapon, _ammo];
</sqf>
}}

Latest revision as of 11:34, 3 September 2024

Hover & click on the images for description

Description

Description:
Returns current weapon mode of unit's weapon.
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 - current mode's classname

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 2014-09-27 - 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];