damage: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|1.5 " to "| ")
(formatting)
Line 1: Line 1:
{{RV|type=command
{{RV|type=command


| ofp
|game1= ofp


|
|version1=
 
|game2= arma1
 
|version2= 1.00
 
|game3= arma2
 
|version3= 1.00
 
|game4= arma2oa
 
|version4= 1.51
 
|game5= tkoh
 
|version5= 1.00
 
|game6= arma3
 
|version6= 0.50


|arg= global
|arg= global
Line 9: Line 29:
|gr1= Object Manipulation
|gr1= Object Manipulation


| Return the damage value of an object.
|descr= Return the damage value of an object.
 
|alias= [[getDammage|getDammage<sup>sic</sup>]]


| [[damage]] object
|s1= [[damage]] object


|p1= object: [[Object]]
|p1= object: [[Object]]


| [[Number]] - the returned number in range (healthy) 0..1 (dead).
|r1= [[Number]] - The returned number in range (healthy) 0..1 (dead).
   
   
|x1= <code>[[?]] (([[damage]] [[player]]) [[a_greater_b|>]] 0.1) : [[player]] [[groupChat]] "I'm hurt! Medic!"</code>
|x1= <code>[[?]] ([[damage]] [[player]]) [[a_greater_b|>]] 0.1) : [[player]] [[groupChat]] "I'm hurt! Medic!" {{cc|SQS}} </code>
 
|x2= <code>[[if]] (([[damage]] [[player]]) [[a_greater_b|>]] 0.1) [[then]] {
|x2= <code>[[if]] (([[damage]] [[player]]) [[a_greater_b|>]] 0.1) [[then]] {
     [[player]] [[groupChat]] "I'm hurt! Medic!";
     [[player]] [[groupChat]] "I'm hurt! Medic!";
};</code>
};</code>
|x3= <code>[[private]] _health = (1 - [[damage]] [[player]]) * 100; {{cc|Health in % from 0 to 100}}</code>
|x3= <code>[[private]] _health = (1 - [[damage]] [[player]]) * 100; {{cc|Health in % from 0 to 100}}</code>


| [[setDamage]], [[setHit]], [[getHit]], [[getHitIndex]], [[setHitIndex]], [[getHitPointDamage]], [[setHitPointDamage]], [[Arma 3: Event Handlers#HandleDamage|"HandleDamage" Event Handler]]
|seealso= [[setDamage]], [[setHit]], [[getHit]], [[getHitIndex]], [[setHitIndex]], [[getHitPointDamage]], [[setHitPointDamage]], [[Arma 3: Event Handlers#HandleDamage|"HandleDamage" Event Handler]]
}}
}}


Line 29: Line 53:
[[Category:Scripting Commands OFP 1.96|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands OFP 1.96|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands OFP 1.99|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands OFP 1.99|{{uc:{{PAGENAME}}}}]]
{{GameCategory|arma1|Scripting Commands}}
{{GameCategory|arma2|Scripting Commands}}
{{GameCategory|arma3|Scripting Commands}}
{{GameCategory|tkoh|Scripting Commands}}


<!-- CONTINUE Notes -->
<!-- CONTINUE Notes -->

Revision as of 11:11, 15 March 2021

Hover & click on the images for description

Description

Description:
Return the damage value of an object.
Alias:
getDammagesic
Groups:
Object Manipulation

Syntax

Syntax:
damage object
Parameters:
object: Object
Return Value:
Number - The returned number in range (healthy) 0..1 (dead).

Examples

Example 1:
? (damage player) > 0.1) : player groupChat "I'm hurt! Medic!" // SQS
Example 2:
if ((damage player) > 0.1) then { player groupChat "I'm hurt! Medic!"; };
Example 3:
private _health = (1 - damage player) * 100; // Health in % from 0 to 100

Additional Information

See also:
setDamagesetHitgetHitgetHitIndexsetHitIndexgetHitPointDamagesetHitPointDamage"HandleDamage" Event Handler

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 February 13, 2015 - 20:20 (UTC)
Pierre MGI
The returned value depends on the couple target/ammo fired. This value has no correlation with the sum of all hitpoints damage status and the effective status of the object. Firing bullets on cars often lead to weird results. For example: damage returns zero while a Hunter is fired at will with an .50 HMG! Hunter can be almost destroyed with zero damage for this function. If you script, use instead the getHitPointDamage command.