canFire: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(templated old notes; added example; simplified boolean description. main description untouched)
(clarified)
Line 9: Line 9:
____________________________________________________________________________________________
____________________________________________________________________________________________


| Returns if the given vehicle is still able to fire. This command checks only the damage value, not the ammo! |= Description
| Returns [[true]] if the given vehicle is still able to fire. For the command to return [[true]], vehicle must be alive, have gunner and the gunners gun cannot be damaged <nowiki>>= 0.9</nowiki> but can be empty due to running out of ammo. [[setVehicleAmmo]] 0 on the other hand will make this command to permanently return [[false]]. |= Description
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[Boolean]] <nowiki>=</nowiki> '''canFire''' unitName|= Syntax
| '''canFire''' unitName|= Syntax


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


| [[Boolean]] -
| [[Boolean]] - true if able to fire |= Return value
true if able to fire |= Return value
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
Line 23: Line 22:


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

Revision as of 01:35, 9 January 2015

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 gunner and the gunners gun cannot be damaged >= 0.9 but can be empty due to running out of ammo. setVehicleAmmo 0 on the other hand will make this command to permanently return false.
Groups:
Uncategorised

Syntax

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

Examples

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

Additional Information

See also:
canMovecanStand

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.

Bottom Section