setAmmo: Difference between revisions
Jump to navigation
Jump to search
Killzone Kid (talk | contribs) No edit summary |
Killzone Kid (talk | contribs) No edit summary |
||
Line 5: | Line 5: | ||
|0.50|= Game version | |0.50|= Game version | ||
|arg= local |= Arguments in MP | |||
|eff= global |= Effects in MP | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| Sets custom ammo count in the currently loaded magazine of the specified weapon. | | 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 | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
Line 28: | Line 32: | ||
<code>[[player]] [[setAmmo]] <nowiki>[</nowiki>[[currentWeapon]] [[player]], 1];</code>|= EXAMPLE2 | <code>[[player]] [[setAmmo]] <nowiki>[</nowiki>[[currentWeapon]] [[player]], 1];</code>|= EXAMPLE2 | ||
|x3= If player is a gunner in a vehicle, set current weapon magazine ammo count to 5 rounds: | |x3= If player is a gunner in a vehicle, set current weapon magazine ammo count to 5 rounds: | ||
<code>[[vehicle]] [[player]] [[setAmmo]] <nowiki>[</nowiki>[[currentWeapon]] [[vehicle]] [[player]], 5]; | <code>[[if]] ([[local]] [[vehicle]] [[player]]) [[then]] { | ||
</code>|= EXAMPLE3 | [[vehicle]] [[player]] [[setAmmo]] <nowiki>[</nowiki>[[currentWeapon]] [[vehicle]] [[player]], 5]; | ||
} [[else]] { | |||
[[diag_log]] "Vehicle must be local to this machine for 'setAmmo' to work"; | |||
};</code>|= EXAMPLE3 | |||
|x4= If you try to set more ammo than the magazine can hold, it will be clipped at default magazine capacity: | |x4= If you try to set more ammo than the magazine can hold, it will be clipped at default magazine capacity: | ||
<code>[[player]] [[setAmmo]] <nowiki>[</nowiki>[[primaryWeapon]] [[player]], 1000000]; //full mag with default ammo count | <code>[[player]] [[setAmmo]] <nowiki>[</nowiki>[[primaryWeapon]] [[player]], 1000000]; //full mag with default ammo count | ||
Line 35: | Line 42: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| | | [[setFuel]], [[setHit]] |= SEEALSO | ||
| | | |= MPBEHAVIOUR | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
}} | }} |
Revision as of 19:18, 22 August 2013
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 { diag_log "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
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