weaponsItems: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (See also)
(5 intermediate revisions by 3 users not shown)
Line 8: Line 8:


| Returns an array with subarrays contains class names and also names of connected items of all the vehicle's weapons.<br/>
| Returns an array with subarrays contains class names and also names of connected items of all the vehicle's weapons.<br/>
Since Arma 3 v1.21.124406 it is possible to query weapon holders and ammo crates with this command. |= Description
Since Arma 3 v1.21.124406 it is possible to query weapon holders and ammo crates with this command. If weapon has no magazine, an empty array [] is returned instead of magazine info.  |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 30: Line 30:
30 //mag ammo count
30 //mag ammo count
],
],
"bipod_01_F_blk", //bipod
"bipod_01_F_blk" //bipod
],
],
[ //=SECONDARY=
[ //=SECONDARY=
Line 94: Line 94:
""
""
]
]
]
]</code>
</code>
|= EXAMPLE2  
|= EXAMPLE2  
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[weaponsItemsCargo]], [[primaryWeaponItems]], [[secondaryWeaponItems]], [[handgunItems]], [[addPrimaryWeaponItem]], [[addSecondaryWeaponItem]], [[addHandgunItem]], [[primaryWeapon]], [[secondaryWeapon]], [[handgunWeapon]], [[weaponAccessories]] |= SEEALSO  
| [[weaponsItemsCargo]], [[primaryWeaponItems]], [[secondaryWeaponItems]], [[handgunItems]], [[addPrimaryWeaponItem]], [[addSecondaryWeaponItem]], [[addHandgunItem]], [[primaryWeapon]], [[secondaryWeapon]], [[handgunWeapon]], [[weaponAccessories]], [[BIS_fnc_weaponComponents]] |= SEEALSO  


|  |= MPBEHAVIOUR  
|  |= MPBEHAVIOUR  
Line 127: Line 126:
"1Rnd_HE_Grenade_shell",
"1Rnd_HE_Grenade_shell",
1
1
]
],
""
]</code>
]</code>


Line 158: Line 158:
]
]
] //If unit has more than one weapon, the output will follow the same pattern as above except with a new element
] //If unit has more than one weapon, the output will follow the same pattern as above except with a new element
]</code><br>
If you use this command on a unit that does not have a magazine loaded, the array containing magazine info is not included (_this select 4). Sample output with running "hint str weaponsItems player;" '''after''' manually removing the magazines from the weapons.<br>Tested with "B_Soldier_F".
<code>[
[
"arifle_MX_ACO_pointer_F",
"",
"acc_pointer_IR",
"optic_Aco"
],
[
"hgun_P07_F",
"",
"",
""
]
]</code>
]</code>
You can use this code to easily check if an array element exists (note the curly brackets):
<code>if (isNil {_weaponsItemsOutput select 4}) then {hint "No magazine is loaded";}</code>
The output does not follow a specific weapon order, weapons will be listed in the order they were picked up or added through script.<br>
This command returns an empty array if the unit has no weapons equipped.<br>
All of this was tested in '''A3 1.32.127785'''
</dd>
</dl>
<!-- DISCONTINUE Notes -->
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on March 16, 2015 - 12:07 (UTC)</dd>
<dt class="note">[[User:Jezuro|Jezuro]]</dt>
<dd class="note">
Since revision 129742, this command also returns an attached bipod.
</dd>
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->
<!-- DISCONTINUE Notes -->

Revision as of 00:08, 3 July 2016

Hover & click on the images for description

Description

Description:
Returns an array with subarrays contains class names and also names of connected items of all the vehicle's weapons.
Since Arma 3 v1.21.124406 it is possible to query weapon holders and ammo crates with this command. If weapon has no magazine, an empty array [] is returned instead of magazine info.
Groups:
Uncategorised

Syntax

Syntax:
weaponsItems vehicle
Parameters:
vehicle: Object - unit or vehicle
Return Value:
Array

Examples

Example 1:
hint str weaponsItems player;
Weaponsitems.jpg

[ [ //=PRIMARY= "arifle_MX_ACO_pointer_F", //weapon "muzzle_snds_H", //suppressor "acc_pointer_IR", //laser "optic_Aco", //optics [ //loaded magazine "30Rnd_65x39_caseless_mag", //mag type 30 //mag ammo count ], "bipod_01_F_blk" //bipod ], [ //=SECONDARY= "launch_NLAW_F", "", "", "", [ "NLAW_F", 1 ], "" ], [ //=HANDGUN= "hgun_P07_F", "muzzle_snds_L", "", "", [ "16Rnd_9x21_Mag", 11 ], "" ] ]

Example 2:
hint str weaponsItems vehicle player; [ [ "gatling_30mm", "", "", "", [ "250Rnd_30mm_HE_shells", 250 ], "" ], [ "missiles_SCALPEL", "", "", "", [ "8Rnd_LG_scalpel", 8 ], "" ], [ "rockets_Skyfire", "", "", "", [ "38Rnd_80mm_rockets", 38 ], "" ] ]

Additional Information

See also:
weaponsItemsCargoprimaryWeaponItemssecondaryWeaponItemshandgunItemsaddPrimaryWeaponItemaddSecondaryWeaponItemaddHandgunItemprimaryWeaponsecondaryWeaponhandgunWeaponweaponAccessoriesBIS_fnc_weaponComponents

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

Notes

Posted on August 17, 2013
AgentRev
Be careful with this function. The weapons are listed in the order they were taken by the unit, with the most recent at the bottom of the array. Therefore, do not assume the first one is always the primary weapon, and so on. Also, here's how the primary weapon looks if it has a grenade launcher with a loaded grenade:

[ "arifle_MX_GL_F", "muzzle_snds_H", "acc_pointer_IR", "optic_Aco", [ "30Rnd_65x39_caseless_mag", 30 ], [ "1Rnd_HE_Grenade_shell", 1 ], "" ]

Bottom Section

Posted on October 25, 2014 - 01:45 (UTC)
DreadedEntity
The output of this command is an array of arrays and is as follows: (If the unit only has 1 weapon, output is an array within an array.) [ [ ((_arr select 0) select 0) //STRING - The weapon's classname ((_arr select 0) select 1) //STRING - Classname of the unit's equipped 'Muzzle/Barrel Accessory' ((_arr select 0) select 2) //STRING - Classname of the unit's equipped 'Side Accessory' ((_arr select 0) select 3) //STRING - Classname of the unit's equipped 'Top/Optic Accessory' ((_arr select 0) select 4) //ARRAY - Magazine information [ (((_arr select 0) select 4) select 0) //STRING - Classname of the loaded magazine (((_arr select 0) select 4) select 1) //SCALAR(Number) - Amount of bullets in the mag ] ] //If unit has more than one weapon, the output will follow the same pattern as above except with a new element ]