setAmmo: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (template:command argument fix)
m (template:command argument fix)
Line 11: Line 11:
____________________________________________________________________________________________
____________________________________________________________________________________________


| 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=


|p1= unit: [[Object]] - Gunner or vehicle.  |PARAMETER1=  
|p1= unit: [[Object]] - Gunner or vehicle.  |PARAMETER1=  

Revision as of 15:46, 7 April 2019

Hover & click on the images for description

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:
Uncategorised

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:
ammosetFuelsetHit

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

Bottom Section