setAmmo: Difference between revisions
Lou Montana (talk | contribs) m (Text replacement - "\{\{GameCategory\|(arma[0123])\|[ _]?New[ _]Scripting[ _]Commands[ _]List\}\}" to "{{GameCategory|$1|New Scripting Commands}}")  | 
				Lou Montana (talk | contribs)  m (Text replacement - "_{10,} " to "")  | 
				||
| Line 1: | Line 1: | ||
{{Command|Comments=  | {{Command|Comments=  | ||
| arma3 |Game name=  | | arma3 |Game name=  | ||
| Line 13: | Line 12: | ||
|gr2= Vehicle Inventory |GROUP2=  | |gr2= Vehicle Inventory |GROUP2=  | ||
| Sets custom ammo count in the currently loaded magazine of the specified weapon. The unit must be [[local]] to the computer where command is executed. |DESCRIPTION=  | | Sets custom ammo count in the currently loaded magazine of the specified weapon. The unit must be [[local]] to the computer where command is executed. |DESCRIPTION=  | ||
| unit '''setAmmo''' [weapon, count] |SYNTAX=  | | unit '''setAmmo''' [weapon, count] |SYNTAX=  | ||
| Line 44: | Line 41: | ||
<code>[[player]] [[setAmmo]] [<nowiki/>[[primaryWeapon]] [[player]], 1000000]; //full mag with default ammo count  | <code>[[player]] [[setAmmo]] [<nowiki/>[[primaryWeapon]] [[player]], 1000000]; //full mag with default ammo count  | ||
</code>|EXAMPLE4=  | </code>|EXAMPLE4=  | ||
| [[ammo]], [[setVehicleAmmo]], [[setFuel]], [[setHit]] |SEEALSO=    | | [[ammo]], [[setVehicleAmmo]], [[setFuel]], [[setHit]] |SEEALSO=    | ||
| |MPBEHAVIOUR=    | | |MPBEHAVIOUR=    | ||
}}  | }}  | ||
Revision as of 02:51, 17 January 2021
Description
- Description:
 - Sets custom ammo count in the currently loaded magazine of the specified weapon. The unit must be local to the computer where command is executed.
 - Groups:
 - Unit InventoryVehicle Inventory
 
Syntax
- Syntax:
 - unit setAmmo [weapon, count]
 - Parameters:
 - unit: Object - Gunner or vehicle.
 - [weapon, count]: Array
 - weapon: String
 - count: Number
 - Return Value:
 - Nothing
 
Examples
- Example 1:
 - Set player's handgun magazine ammo count to 10 rounds:
player setAmmo [handgunWeapon player, 10]; - Example 2:
 - Set player's current weapon magazine ammo count to 1 round:
player setAmmo [currentWeapon player, 1]; - Example 3:
 - If player is a gunner in a vehicle, set current weapon magazine ammo count to 5 rounds:
if (local vehicle player) then { vehicle player setAmmo [currentWeapon vehicle player, 5]; } else { hint "Vehicle must be local to this machine for 'setAmmo' to work"; }; - Example 4:
 - If you try to set more ammo than the magazine can hold, it will be clipped at default magazine capacity:
player setAmmo [primaryWeapon player, 1000000]; //full mag with default ammo count 
Additional Information
- See also:
 - ammosetVehicleAmmosetFuelsetHit
 
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