Arma 3 Scripting

Command in Weapons

canFire

Also available as Markdown and JSON, or read the original wiki page.

Description

Returns true if the given vehicle is still able to fire. For the command to return true, vehicle must be alive, have weapon operator and the weapon cannot be damaged ≥ 0.9 but can be empty due to running out of ammo. If mission starts with vehicle having no ammo or setVehicleAmmo 0 command is executed on the vehicle, then canFire will always report false for it.

Syntax

canFire unitName

Parameters:

Returns: Boolean - true if able to fire

Examples

Example 1

if (not canFire _tank) then
{
    player sideChat "Tank disabled!";
};

See also

canMove · canStand · fire · doFire · commandFire · fireAtTarget · forceWeaponFire · commandArtilleryFire · commandSuppressiveFire · doArtilleryFire · doSuppressiveFire · isManualFire

Community notes

Bdfy

true even if unit is out of ammo. Only false if gun is damaged.

Canukausiuka

False if there is no gunner in the vehicle, regardless of damage level.

Pierre MGI

This command seems to have evolved. Returns "true" (on Hunter, Ifrit) even if Gun's damage is set to 1 and turret also, as far there is a gunner. The only way to obtain a canFire "false" is to make the crew disembark (2 burned tires for example). Then no matter the gun state, if the gunner disembarks without order, the vehicle can't fire. In this case: can't move >> can't fire. NB: if you jump into a hunter HMG after having setHitPointDamage(d) "hitTurret" and "hitGun" to 1, the turret can't rotate any more, the gun is pitched down but you can fire (trigger) to the ground. Difficult to check the behavior for each vehicles.