setAmmo: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\|game([0-9]) ?= (.+) \|version([0-9]) ?= (.+) " to "|game$1= $2 |version$3= $4 ") |
Lou Montana (talk | contribs) m (Text replacement - "\|s([0-9])\= ([^' ]+)'''([^' ]+)'''([^ ]*) " to "|s$1= $2$3$4 ") |
||
Line 14: | Line 14: | ||
|descr= Sets custom ammo count in the currently loaded magazine of the specified weapon or muzzle. | |descr= Sets custom ammo count in the currently loaded magazine of the specified weapon or muzzle. | ||
|s1= unit | |s1= unit [[setAmmo]] [weaponOrMuzzle, count] | ||
|p1= unit: [[Object]] - Gunner or vehicle. | |p1= unit: [[Object]] - Gunner or vehicle. |
Revision as of 18:08, 20 June 2021
Description
- Description:
- Sets custom ammo count in the currently loaded magazine of the specified weapon or muzzle.
- Groups:
- Unit InventoryVehicle Inventory
Syntax
- Syntax:
- unit setAmmo [weaponOrMuzzle, count]
- Parameters:
- unit: Object - Gunner or vehicle.
- weaponOrMuzzle: String - Weapon name. Muzzle name in case the weapon has more than one muzzle, e.g. weapon with grenade launcher. See CfgWeapons for muzzle names
- 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
- Example 5:
- Some weapons has more than one muzzles:
_marshall setAmmo ["autocannon_40mm_CTWS", 0];// won't work _marshall setAmmo ["HE", 0];// works
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