addWeaponItem: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(optional param)
m (Fix parameter)
 
(48 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma3 |= Game name
|game1= arma3
|version1= 1.38


|1.38|= Game version
|arg= local


|arg= local |= Arguments in MP
|eff= global


|eff= global |= Effects in MP
|gr1= Unit Inventory
____________________________________________________________________________________________


| Adds a weapon item to the specified weapon. The item can be weapon magazine, in which case the amount of ammo and target muzzle could also be specified.
|descr= Adds a weapon item to the specified weapon. The item can be weapon magazine, in which case the amount of ammo and target muzzle could also be specified.
* Since Arma 3 v1.95 it is possible to add item instantly skipping the animation by providing optional boolean|DESCRIPTION=
____________________________________________________________________________________________


| unit '''addWeaponItem''' [weaponName, itemName, instant]|SYNTAX1=
|s1= unit [[addWeaponItem]] [weaponName, itemName, instant]


|p1= unit: [[Object]] |PARAMETER1=
|p1= unit: [[Object]]
|p2= [weaponName, itemName, instant]: [[Array]] |PARAMETER2=
|p3= weaponName: [[String]] - name of the weapon to add magazine to |PARAMETER3=
|p4 = itemName: [[String]] - class name of the item to add (if magazine, muzzle will be autodetected)|PARAMETER4=
|p5 = instant (Optional): [[Boolean]] - [[true]] to skip animation. Default: [[false]] |PARAMETER5=


| [[Nothing]] |RETURNVALUE1=
|p2= weaponName: [[String]] - name of the weapon to add magazine to


| s2= unit '''addWeaponItem''' [weaponName, [itemName, ammoCount, muzzleName], instant]|SYNTAX2=
|p3= itemName: [[String]] - class name of the item to add (if magazine, muzzle will be autodetected)


|p21= unit: [[Object]] |PARAMETER21=
|p4= instant: [[Boolean]] - (Optional, default [[false]]) [[true]] to skip animation
|p22= [weaponName, [magazineName, ammoCount, muzzleName], instant]: [[Array]] |PARAMETER22=
|p4since= arma3 1.96
|p23= weaponName: [[String]] - name of the weapon to add magazine to |PARAMETER23=
|p24= [itemName, ammoCount, muzzleName]: [[Array]] |PARAMETER24=
|p25 = itemName: [[String]] - class name of the item to add (if magazine, muzzle will be autodetected unless specified)|PARAMETER25=
|p26 = ammoCount (Optional): [[Number]] - optional amount of ammo in magazine|PARAMETER26=
|p27 = muzzleName (Optional): [[String]] - optional target muzzle to add magazine to |PARAMETER27=
|p28 = instant (Optional): [[Boolean]] - [[true]] to skip animation. Default: [[false]] |PARAMETER28=


|r2= [[Nothing]] |RETURNVALUE2=
|r1= [[Nothing]]
____________________________________________________________________________________________


|x1= <code>[[player]] [[addWeaponItem]] ["arifle_MX_GL_ACO_F", "1Rnd_HE_Grenade_shell"];</code> |EXAMPLE1=
|s2= unit [[addWeaponItem]] [weaponName, [itemName, ammoCount, muzzleName], instant]
|x2= <code>[[player]] [[addWeaponItem]] ["arifle_MX_GL_ACO_F", ["1Rnd_HE_Grenade_shell", 1, "GL_3GL_F"]];</code> |EXAMPLE2=
____________________________________________________________________________________________


| [[addPrimaryWeaponItem]], [[addSecondaryWeaponItem]], [[addHandgunItem]], [[weaponsItems]], [[handgunItems]], [[primaryWeaponItems]], [[secondaryWeaponItems]], [[removePrimaryWeaponItem]], [[removeSecondaryWeaponItem]], [[removeHandgunItem]] |SEEALSO=
|p21= unit: [[Object]]


}}
|p22= weaponName: [[String]] - name of the weapon to add magazine to
 
|p23= itemName: [[String]] - class name of the item to add (if magazine, muzzle will be autodetected unless specified)
 
|p24= ammoCount: [[Number]] - (Optional) optional amount of ammo in magazine
 
|p25= muzzleName: [[String]] - (Optional) optional target muzzle to add magazine to
 
|p26= instant: [[Boolean]] - (Optional, default [[false]]) [[true]] to skip animation
|p26since= arma3 1.96
 
|r2= [[Nothing]]
 
|x1= <sqf>player addWeaponItem ["arifle_MX_GL_ACO_F", "1Rnd_HE_Grenade_shell"];</sqf>


<h3 style="display:none">Notes</h3>
|x2= <sqf>player addWeaponItem ["arifle_MX_GL_ACO_F", ["1Rnd_HE_Grenade_shell", 1, "GL_3GL_F"]];</sqf>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>


<h3 style="display:none">Bottom Section</h3>
|x3= <sqf>player addWeaponItem ["LaserDesignator", "LaserBatteries"];</sqf>


[[Category:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
|seealso= [[addPrimaryWeaponItem]] [[addSecondaryWeaponItem]] [[addHandgunItem]] [[addBinocularItem]] [[weaponsItems]] [[handgunItems]] [[primaryWeaponItems]] [[secondaryWeaponItems]] [[binocularItems]] [[removePrimaryWeaponItem]] [[removeSecondaryWeaponItem]] [[removeHandgunItem]] [[removeBinocularItem]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
}}
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]

Latest revision as of 15:44, 16 June 2023

Hover & click on the images for description

Description

Description:
Adds a weapon item to the specified weapon. The item can be weapon magazine, in which case the amount of ammo and target muzzle could also be specified.
Groups:
Unit Inventory

Syntax

Syntax:
unit addWeaponItem [weaponName, itemName, instant]
Parameters:
unit: Object
weaponName: String - name of the weapon to add magazine to
itemName: String - class name of the item to add (if magazine, muzzle will be autodetected)
since Arma 3 logo black.png1.96
instant: Boolean - (Optional, default false) true to skip animation
Return Value:
Nothing

Alternative Syntax

Syntax:
unit addWeaponItem [weaponName, [itemName, ammoCount, muzzleName], instant]
Parameters:
unit: Object
weaponName: String - name of the weapon to add magazine to
itemName: String - class name of the item to add (if magazine, muzzle will be autodetected unless specified)
ammoCount: Number - (Optional) optional amount of ammo in magazine
muzzleName: String - (Optional) optional target muzzle to add magazine to
since Arma 3 logo black.png1.96
instant: Boolean - (Optional, default false) true to skip animation
Return Value:
Nothing

Examples

Example 1:
player addWeaponItem ["arifle_MX_GL_ACO_F", "1Rnd_HE_Grenade_shell"];
Example 2:
player addWeaponItem ["arifle_MX_GL_ACO_F", ["1Rnd_HE_Grenade_shell", 1, "GL_3GL_F"]];
Example 3:
player addWeaponItem ["LaserDesignator", "LaserBatteries"];

Additional Information

See also:
addPrimaryWeaponItem addSecondaryWeaponItem addHandgunItem addBinocularItem weaponsItems handgunItems primaryWeaponItems secondaryWeaponItems binocularItems removePrimaryWeaponItem removeSecondaryWeaponItem removeHandgunItem removeBinocularItem

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