canFire: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "[[Category:Scripting Commands ArmA|" to "[[Category:Scripting Commands Armed Assault|")
m (Text replacement - "\|x([0-9])= *<code>([^<]*)<\/code>" to "|x$1= <sqf>$2</sqf>")
(48 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| ofp |Game name=
|game1= ofp
|version1= 1.00


|1.00|Game version=
|game2= ofpe
|version2= 1.00


|arg= global |Multiplayer Arguments=
|game3= arma1
____________________________________________________________________________________________
|version3= 1.00


| 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 &ge; 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. |DESCRIPTION=
|game4= arma2
____________________________________________________________________________________________
|version4= 1.00


| [[canFire]] unitName |SYNTAX=
|game5= arma2oa
|version5= 1.50


|p1= unitName: [[Object]] |PARAMETER1=
|game6= tkoh
|version6= 1.00


| [[Boolean]] - [[true]] if able to fire |RETURNVALUE=
|game7= arma3
____________________________________________________________________________________________
|version7= 0.50
 
 
|x1= <code>[[if]] ([[not]] [[canFire]] _tank) [[then]]
|arg= global
 
|gr1= Weapons
 
|descr= 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 &ge; 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.
 
|s1= [[canFire]] unitName
 
|p1= unitName: [[Object]]
 
|r1= [[Boolean]] - [[true]] if able to fire
 
|x1= <sqf>if (not canFire _tank) then
{
{
[[player]] [[sideChat]] "Tank disabled!";
player sideChat "Tank disabled!";
};</code> |EXAMPLE1=
};</sqf>
____________________________________________________________________________________________


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


<h3 style="display:none">Notes</h3>
<dl class="command_description">
<dl class="command_description">
<!-- Note Section BEGIN -->
 
<dd class="notedate">Posted on 07:16, 20 January 2007 (CEST)
<dt></dt>
<dt class="note">[[User:Bdfy|Bdfy]]
<dd class="notedate">Posted on 07:16, 20 January 2007 (CEST)</dd>
<dt class="note">[[User:Bdfy|Bdfy]]</dt>
<dd class="note">
<dd class="note">
true even if unit is out of ammo. Only false if gun is damaged.  
true even if unit is out of ammo. Only false if gun is damaged.  
 
<dt><dt>
<dd class="notedate">Posted on 05:20, 24 August 2008 (CEST)
<dd class="notedate">Posted on 05:20, 24 August 2008 (CEST)</dd>
<dt class="note">[[User:Canukausiuka|Canukausiuka]]
<dt class="note">[[User:Canukausiuka|Canukausiuka]]</dt>
<dd class="note">
<dd class="note">
False if there is no gunner in the vehicle, regardless of damage level.
False if there is no gunner in the vehicle, regardless of damage level.
 
<dt><dt>
<dd class="notedate">Posted on 07:20, 23 April 2018 (UTC)
<dd class="notedate">Posted on 07:20, 23 April 2018 (UTC)</dd>
<dt class="note">[[User:Pierre MGI|Pierre MGI]]
<dt class="note">[[User:Pierre MGI|Pierre MGI]]</dt>
<dd class="note">
<dd class="note">
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.
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.
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.</dl>
<!-- Note Section END --></dl>
 
<h3 style="display:none">Bottom Section</h3>
 
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands OFP 1.46|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands OFP 1.96|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands OFP 1.99|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Armed Assault|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Command Group: Object Information|{{uc:{{PAGENAME}}}}]]

Revision as of 10:21, 13 May 2022

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:
Weapons

Syntax

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

Examples

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

Additional Information

See also:
canMove canStand fire doFire commandFire fireAtTarget forceWeaponFire commandArtilleryFire commandSuppressiveFire doArtilleryFire doSuppressiveFire isManualFire

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
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.