setVehicleAmmo: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " \| *(game[0-9]|version[0-9]|gr[0-9]|serverExec|mp|pr|descr|s[0-9]|p[0-9]{1,3}|r[0-9]|x1?[0-9]|seealso) *= +" to " |$1= ")
m (Text replacement - "kju" to ".kju")
 
(15 intermediate revisions by the same user not shown)
Line 22: Line 22:
|gr1= Vehicle Inventory
|gr1= Vehicle Inventory


|descr= Sets how much ammunition (compared to a full state defined by the vehicle type) the vehicle has. Note that the ammo will be added only to [[local]] turrets. To check locality of turret use [[turretLocal]].
|descr= Sets how much ammunition (compared to a full state defined by the vehicle type) the vehicle has. Note that the ammo will be added only to [[Multiplayer Scripting#Locality|local]] turrets. To check locality of turret use [[turretLocal]].


The value ranges from 0 to 1.
The value ranges from 0 to 1.


|s1= vehicleName '''setVehicleAmmo''' value
|s1= vehicleName [[setVehicleAmmo]] value


|p1= vehicleName: [[Object]]
|p1= vehicleName: [[Object]]
Line 32: Line 32:
|p2= value: [[Number]] - 0: empty, 1: full
|p2= value: [[Number]] - 0: empty, 1: full


|r1=[[Nothing]]
|r1= [[Nothing]]


|x1= <code>[[player]] [[setVehicleAmmo]] 0;</code>
|x1= <sqf>player setVehicleAmmo 0;</sqf>
|x2= <code>_vehicle [[setVehicleAmmo]] 1;</code>
|x2= <sqf>_vehicle setVehicleAmmo 1;</sqf>


|seealso= [[setVehicleAmmoDef]], [[ammo]], [[setAmmo]], [[setAmmoCargo]], [[turretLocal]]
|seealso= [[setVehicleAmmoDef]] [[ammo]] [[setAmmo]] [[setAmmoCargo]] [[turretLocal]]
}}
}}


Line 52: Line 52:
<dt><dt>
<dt><dt>
<dd class="notedate">
<dd class="notedate">
<dt class="note">[[User:kju|kju]]</dt>
<dt class="note">[[User:.kju|.kju]]</dt>
<dd class="note">
<dd class="note">
* If you 'unit/vehicle setVehicleAmmo 0;' an unit/vehicle first, you cannot refill it with 'unit/vehicle setVehicleAmmo 1;'.
* If you 'unit/vehicle setVehicleAmmo 0;' an unit/vehicle first, you cannot refill it with 'unit/vehicle setVehicleAmmo 1;'.
* You need to execute where the unit is [[local]].
* You need to execute where the unit is [[Multiplayer Scripting#Locality|local]].
* You need to execute on the [[effectiveCommander]] of a vehicle.
* You need to execute on the [[effectiveCommander]] of a vehicle.
<dt><dt>
<dt><dt>
Line 68: Line 68:
* In Arma 3, when using this on a player, this command can only reduce the number of magazine in relation to the current ammo quantity of the unit. For example if player has 8 magazines, [[player]] [[setVehicleAmmo]] 0.5; will leave unit with 4 mags. Executing [[player]] [[setVehicleAmmo]] 0.5; again will leave unit with 2 mags. [[player]] [[setVehicleAmmo]] 0.5; again -> 1 mag. [[player]] [[setVehicleAmmo]] 0; will remove all mags. If player had 10 mags with 30 bullets in each, [[player]] [[setVehicleAmmo]] 0.01; will leave player with loaded mag with 3 bullets in it (300 x 0.01 = 3)
* In Arma 3, when using this on a player, this command can only reduce the number of magazine in relation to the current ammo quantity of the unit. For example if player has 8 magazines, [[player]] [[setVehicleAmmo]] 0.5; will leave unit with 4 mags. Executing [[player]] [[setVehicleAmmo]] 0.5; again will leave unit with 2 mags. [[player]] [[setVehicleAmmo]] 0.5; again -> 1 mag. [[player]] [[setVehicleAmmo]] 0; will remove all mags. If player had 10 mags with 30 bullets in each, [[player]] [[setVehicleAmmo]] 0.01; will leave player with loaded mag with 3 bullets in it (300 x 0.01 = 3)


</dl>
<dl class="command_description">


<dt></dt>
<dt></dt>
<dd class="notedate">Posted on December 20, 2014 - 21:55 (UTC)</dd>
<dd class="notedate">Posted on 2014-12-20 - 21:55 (UTC)</dd>
<dt class="note">[[User:Actium|Actium]]</dt>
<dt class="note">[[User:Actium|Actium]]</dt>
<dd class="note">
<dd class="note">

Latest revision as of 20:32, 3 May 2024

Hover & click on the images for description

Description

Description:
Sets how much ammunition (compared to a full state defined by the vehicle type) the vehicle has. Note that the ammo will be added only to local turrets. To check locality of turret use turretLocal. The value ranges from 0 to 1.
Groups:
Vehicle Inventory

Syntax

Syntax:
vehicleName setVehicleAmmo value
Parameters:
vehicleName: Object
value: Number - 0: empty, 1: full
Return Value:
Nothing

Examples

Example 1:
player setVehicleAmmo 0;
Example 2:
_vehicle setVehicleAmmo 1;

Additional Information

See also:
setVehicleAmmoDef ammo setAmmo setAmmoCargo turretLocal

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
Ceeeb
This command does not add magazines to vehicle weapons that normally start with more than one magazine. It can however, remove these magazines.
Bon_Inf*
A2:OA v1.59 - Magazines of vehicle turrets are also refilled by this command.
.kju
  • If you 'unit/vehicle setVehicleAmmo 0;' an unit/vehicle first, you cannot refill it with 'unit/vehicle setVehicleAmmo 1;'.
  • You need to execute where the unit is local.
  • You need to execute on the effectiveCommander of a vehicle.
Galzohar
  • In Arma 3, using this command seems correctly rearm the vehicle and its turrets in all situations (tested with beta 0.72).
Killzone_Kid
  • In Arma 3, when using this on a player, this command can only reduce the number of magazine in relation to the current ammo quantity of the unit. For example if player has 8 magazines, player setVehicleAmmo 0.5; will leave unit with 4 mags. Executing player setVehicleAmmo 0.5; again will leave unit with 2 mags. player setVehicleAmmo 0.5; again -> 1 mag. player setVehicleAmmo 0; will remove all mags. If player had 10 mags with 30 bullets in each, player setVehicleAmmo 0.01; will leave player with loaded mag with 3 bullets in it (300 x 0.01 = 3)
Posted on 2014-12-20 - 21:55 (UTC)
Actium
This command does not operate compared to a full state defined by the vehicle type, but rather relative to a vehicle's current magazine loadout. To get the former behaviour use setVehicleAmmoDef, which utilizes the vehicles default magazine loadout (i.e. its CfgVehicles magazines[] values).