weaponsItems: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Added note with grenade launcher example, and warning about array order)
m (Corrected formatting of examples, edited previous note a bit.)
Line 17: Line 17:




|x1= [[Image:Weaponsitems.jpg|200px|right|border]]<code>[[hint]] [[str]] [[weaponsItems]] [[player]];
|x1= <code>[[hint]] [[str]] [[weaponsItems]] [[player]];</code>
 
[[Image:Weaponsitems.jpg|200px|right|border]]
[
<code>[
[ //=PRIMARY=
[ //=PRIMARY=
"arifle_MX_ACO_pointer_F", //weapon
"arifle_MX_ACO_pointer_F", //weapon
Line 29: Line 29:
30 //mag ammo count
30 //mag ammo count
]
]
],[ //=SECONDARY=
],
[ //=SECONDARY=
"launch_NLAW_F",
"launch_NLAW_F",
"",
"",
Line 38: Line 39:
1
1
]
]
],[ //=HANDGUN=
],
[ //=HANDGUN=
"hgun_P07_F",
"hgun_P07_F",
"muzzle_snds_L",
"muzzle_snds_L",
Line 49: Line 51:
]
]
]
]
</code>|= EXAMPLE1  
</code>
|= EXAMPLE1  


|x2= <code>[[hint]] [[str]] [[weaponsItems]] [[vehicle]] [[player]];
|x2= <code>[[hint]] [[str]] [[weaponsItems]] [[vehicle]] [[player]];</code>


[
<code>[
[
[
"gatling_30mm",
"gatling_30mm",
Line 63: Line 66:
250
250
]
]
],[
],
[
"missiles_SCALPEL",
"missiles_SCALPEL",
"",
"",
Line 72: Line 76:
8
8
]
]
],[
],
[
"rockets_Skyfire",
"rockets_Skyfire",
"",
"",
Line 84: Line 89:
]
]
</code>
</code>
|= EXAMPLE2  
|= EXAMPLE2  
____________________________________________________________________________________________
____________________________________________________________________________________________
Line 100: Line 104:
<dd class="notedate">Posted on 17 August, 20123
<dd class="notedate">Posted on 17 August, 20123
<dt class="note">[[User:AgentRev01|AgentRev]]<dd class="note">
<dt class="note">[[User:AgentRev01|AgentRev]]<dd class="note">
Here's how the primary weapon looks if you have a grenade launcher and grenade loaded inside it:
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.
<br/>
 
Also, here's how the primary weapon looks if you have a grenade launcher and grenade loaded in it:<br/>
<br/>
<br/>
<code>[
<code>[
Line 117: Line 122:
]
]
]</code>
]</code>
<br/>
Also, 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.





Revision as of 18:35, 17 August 2013

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.
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 ] ], [ //=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:
primaryWeaponItemssecondaryWeaponItemshandgunItemsaddPrimaryWeaponItemaddSecondaryWeaponItemaddHandgunItemprimaryWeaponsecondaryWeaponhandgunWeapon

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 17 August, 20123
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 you have a grenade launcher and grenade loaded in it:

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

Bottom Section