canFire: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Bot: Reverted to revision 98185 by killzone_kid on 2016-12-14T09:04:59Z)
m (template:command argument fix)
Line 9: Line 9:
____________________________________________________________________________________________
____________________________________________________________________________________________


| 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 <nowiki>>= 0.9</nowiki> 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. |= 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 <nowiki>>= 0.9</nowiki> 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. |DESCRIPTION=
____________________________________________________________________________________________
____________________________________________________________________________________________


| '''canFire''' unitName|= Syntax
| '''canFire''' unitName|SYNTAX=


|p1= unitName: [[Object]] |= Parameter 1
|p1= unitName: [[Object]] |PARAMETER1=


| [[Boolean]] - true if able to fire |= Return value
| [[Boolean]] - true if able to fire |RETURNVALUE=
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
|x1= SQS: <code>?!([[canFire]] _tank) : [[player]] [[sideChat]] "Tank disabled!"</code> |= Example 1
|x1= SQS: <code>?!([[canFire]] _tank) : [[player]] [[sideChat]] "Tank disabled!"</code> |EXAMPLE1=


|x2= SQF:<code>[[if]] ([[!]]([[canFire]] _tank)) [[then]] {
|x2= SQF:<code>[[if]] ([[!]]([[canFire]] _tank)) [[then]] {
[[player]] [[sideChat]] "Tank disabled!";
[[player]] [[sideChat]] "Tank disabled!";
};</code> |= Example 2
};</code> |EXAMPLE2=
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[canMove]], [[canStand]], [[fire]], [[doFire]], [[commandFire]], [[fireAtTarget]], [[forceWeaponFire]], [[commandArtilleryFire]], [[commandSuppressiveFire]], [[doArtilleryFire]], [[doSuppressiveFire]], [[isManualFire]] |= See also
| [[canMove]], [[canStand]], [[fire]], [[doFire]], [[commandFire]], [[fireAtTarget]], [[forceWeaponFire]], [[commandArtilleryFire]], [[commandSuppressiveFire]], [[doArtilleryFire]], [[doSuppressiveFire]], [[isManualFire]] |SEEALSO=


}}
}}

Revision as of 14:35, 7 April 2019

Hover & click on the images for description

Description

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

Syntax

Syntax:
canFire unitName
Parameters:
unitName: Object
Return Value:
Boolean - true if able to fire

Examples

Example 1:
SQS: ?!(canFire _tank) : player sideChat "Tank disabled!"
Example 2:
SQF:if (!(canFire _tank)) then { player sideChat "Tank disabled!"; };

Additional Information

See also:
canMovecanStandfiredoFirecommandFirefireAtTargetforceWeaponFirecommandArtilleryFirecommandSuppressiveFiredoArtilleryFiredoSuppressiveFireisManualFire

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

Posted on 07:16, 20 January 2007 (CEST)
Bdfy
true even if unit is out of ammo. Only false if gun is damaged.
Posted on 05:20, 24 August 2008 (CEST)
Canukausiuka
False if there is no gunner in the vehicle, regardless of damage level.
Posted on 07:20, 23 April 2018 (UTC)
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.

Bottom Section