currentWeapon: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - ">Posted on July ([0-9]{2})[ a-zA-Z]*, ([0-9]{4})" to ">Posted on $2-07-$1")
 
(60 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma2 |= Game name
|game1= arma2
|version1= 1.00


|1.00|= Game version
|game2= arma2oa
____________________________________________________________________________________________
|version2= 1.50


| Return the name of the currently selected weapon (on the primary turret for vehicles).  |= Description
|game3= tkoh
____________________________________________________________________________________________
|version3= 1.00


| '''currentWeapon''' vehicle |= Syntax
|game4= arma3
|version4= 0.50


|p1= vehicle: [[Object]] |= PARAMETER1
|gr1= Weapons


|p2= |= PARAMETER2
|gr2= Unit Inventory


|p3= |= PARAMETER3
|descr= Return the name of the currently selected weapon (on the primary turret for vehicles).


| [[String]] |= RETURNVALUE
|s1= [[currentWeapon]] vehicle


|p1= vehicle: [[Object]]


|x1= <pre>_weaponClass = currentWeapon (vehicle player);//Example: "M16A2GL"</pre>|= EXAMPLE1
|r1= [[String]]
|x2= <pre>_weaponClass = currentWeapon player;</pre>|= EXAMPLE2


____________________________________________________________________________________________
|x1= <sqf>_weaponClass = currentWeapon (vehicle player);//Example: "M16A2GL"</sqf>
|x2= <sqf>_weaponClass = currentWeapon player;</sqf>


| [[currentMagazine]], [[currentMuzzle]], [[currentVisionMode]], [[currentWeaponMode]], [[currentZeroing]], [[magazinesTurret]], [[weaponsTurret]] |= SEEALSO
|seealso= [[currentMagazine]] [[currentMuzzle]] [[currentThrowable]] [[currentVisionMode]] [[currentWeaponMode]] [[currentZeroing]] [[magazinesTurret]] [[weaponsTurret]]
}}


|  |= MPBEHAVIOUR
<dl class="command_description">
____________________________________________________________________________________________
}}


<h3 style='display:none'>Notes</h3>
<dt></dt>
<dl class='command_description'>
<dd class="notedate">Posted on 2009-07-15 - 04:00 (CEST)</dd>
<!-- Note Section BEGIN -->
<dt class="note">[[User:Lou Montana|Lou Montana]]</dt>
<dd class="notedate">Posted on July 15, 2009 - 04:00 (CEST)
<dt class="note">'''[[User:Lou Montana|Lou Montana]]'''
<dd class="note">You have to make a little delay (sleep 0.001; (not less)) to use this command, else you will be returned an empty string.
<dd class="note">You have to make a little delay (sleep 0.001; (not less)) to use this command, else you will be returned an empty string.
<dd class="notedate">Posted on July 15, 2009 - 04:00 (CEST)
<dd class="notedate">Posted on 2009-07-15 - 04:00 (CEST)</dd>
<dt class="note">'''[[User:Lou Montana|Lou Montana]]'''
<dt class="note">[[User:Lou Montana|Lou Montana]]</dt>
<dd class="note">It seems it's not working in 1.02 for other unit than player.
<dd class="note">It seems it is not working in 1.02 for other unit than player.
 
<dt><dt>
<dd class="notedate">Posted on May 4, 2010
<dd class="notedate">Posted on 2010-05-04</dd>
<dt class="note">'''[[User:Terox|Terox]]'''
<dt class="note">[[User:Terox|Terox]]</dt>
<dd class="note">This works for vehicles providing there is a gunner
<dd class="note">This works for vehicles providing there is a gunner
<!-- Note Section END -->
</dl>
<h3 style='display:none'>Bottom Section</h3>
[[Category:ArmA 2: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on October 2, 2015 - 04:28 (UTC)</dd>
<dt class="note">[[User:Pierre MGI|Pierre MGI]]</dt>
<dd class="note">
Place a non-armed vehicle in your group. Ask for currentWeapon (driver vehicle) (in a loop with cursortarget for example). There is no result. Make the driver disembark. The man has a weapon and this command starts to work (the AI unit is also is own driver). Make this AI jump into the vehicle. Now, the info of current weapon of the driver is persistent.
There is no way, on my knowledge to easily check if an embarked unit has a weapon until this unit jump out / into a vehicle.
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 23:09, 13 May 2023

Hover & click on the images for description

Description

Description:
Return the name of the currently selected weapon (on the primary turret for vehicles).
Groups:
WeaponsUnit Inventory

Syntax

Syntax:
currentWeapon vehicle
Parameters:
vehicle: Object
Return Value:
String

Examples

Example 1:
_weaponClass = currentWeapon (vehicle player);//Example: "M16A2GL"
Example 2:
_weaponClass = currentWeapon player;

Additional Information

See also:
currentMagazine currentMuzzle currentThrowable currentVisionMode currentWeaponMode currentZeroing magazinesTurret weaponsTurret

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 2009-07-15 - 04:00 (CEST)
Lou Montana
You have to make a little delay (sleep 0.001; (not less)) to use this command, else you will be returned an empty string.
Posted on 2009-07-15 - 04:00 (CEST)
Lou Montana
It seems it is not working in 1.02 for other unit than player.
Posted on 2010-05-04
Terox
This works for vehicles providing there is a gunner