addWeapon: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
Line 11: Line 11:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Add a weapon to a unit. Infantry units can only carry a specific number of weapons, once the weapon slots are filled, any further addWeapon commands are ignored. |= Description
| Add a weapon to a unit. The unit must be [[local]]. For a global version of this command see [[addWeaponGlobal]].
 
Infantry units can only carry a specific number of weapons, once the weapon slots are filled, any further [[addWeapon]] commands are ignored. |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


| unitName '''addWeapon''' weaponName |= Syntax
| unit '''addWeapon''' weapon |= Syntax


|p1= unitName: [[Object]] - unit to add the weapon to |= Parameter 1
|p1= unit: [[Object]] - unit or vehicle to add the weapon to |= Parameter 1


|p2= weaponName: [[String]] - weapon name. See the topic [[:Category:Weapons]] for reference about possible values. |= Parameter 2
|p2= weapon: [[String]] - weapon class name. See the topic [[:Category:Weapons]] for reference about possible values. |= Parameter 2


| [[Nothing]] |= Return value
| [[Nothing]] |= Return value
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
|x1= <pre>player addWeapon "M16"</pre> |= Example 1
|x1= <code>[[player]] [[addMagazine]] "30Rnd_556x45_Stanag";
[[player]] [[addWeapon]] "BAF_L85A2_RIS_SUSAT";</code> |= Example 1
 
|x2= <code>An_2 [[addMagazine]] "100Rnd_762x51_M240";
An_2 [[addWeapon]] "M240_veh";</code> |= Example 2
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[removeWeapon]], [[removeAllWeapons]], [[addMagazine]] |= See also
| [[addWeaponGlobal]], [[removeWeapon]], [[removeAllWeapons]], [[addMagazine]] |= See also


}}
}}

Revision as of 11:29, 7 August 2013

Hover & click on the images for description

Description

Description:
Add a weapon to a unit. The unit must be local. For a global version of this command see addWeaponGlobal. Infantry units can only carry a specific number of weapons, once the weapon slots are filled, any further addWeapon commands are ignored.
Groups:
Uncategorised

Syntax

Syntax:
unit addWeapon weapon
Parameters:
unit: Object - unit or vehicle to add the weapon to
weapon: String - weapon class name. See the topic Category:Weapons for reference about possible values.
Return Value:
Nothing

Examples

Example 1:
player addMagazine "30Rnd_556x45_Stanag"; player addWeapon "BAF_L85A2_RIS_SUSAT";
Example 2:
An_2 addMagazine "100Rnd_762x51_M240"; An_2 addWeapon "M240_veh";

Additional Information

See also:
addWeaponGlobalremoveWeaponremoveAllWeaponsaddMagazine

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 2, 2006 - 10:19
hardrock
Notes from before the conversion: To ensure that the weapon is loaded at the start of the mission, add at least one magazine (addMagazine) before adding the weapon. To remove weapons use the removeAllWeapons or the removeWeapon commands.
talkingtoaj
When adding a weapon in-game, a bug means that sometimes the weapon can't be fired. Swap to a different weapon and swap back again to enable the newly added weapon to fire; or drop and pick up the weapon again.

Bottom Section