damage: 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 - "\]\] +\[\[" to "]] [[")
 
(50 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| ofp |Game name=
|game1= ofp


|1.5|Game version=
|version1=


|arg= global |Multiplayer Arguments=
|game2= arma1
____________________________________________________________________________________________
|version2= 1.00


| Return the damage value of an object. |DESCRIPTION=
|game3= arma2
____________________________________________________________________________________________
|version3= 1.00


| [[damage]] object |SYNTAX=
|game4= arma2oa
|version4= 1.50


|p1= object: [[Object]] |PARAMETER1=
|game5= tkoh
|version5= 1.00


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


| [[setDamage]], [[setHit]], [[getHit]], [[getHitIndex]], [[setHitIndex]], [[getHitPointDamage]], [[setHitPointDamage]], [[Arma 3: Event Handlers#HandleDamage|"HandleDamage" Event Handler]] |SEEALSO=
|arg= global
}}
 
|gr1= Object Manipulation
 
|descr= Return the damage value of an object.
 
|alias= [[getDammage|getDammage<sup>sic</sup>]] <!-- cannot use {{sic}} here (counts it as alias link) -->
 
|s1= [[damage]] object
 
|p1= object: [[Object]]
 
|r1= [[Number]] - the returned number in range (healthy) 0..1 (dead).


<h3 style="display:none">Notes</h3>
|x1= <sqs>? damage player > 0.1 : player groupChat "I'm hurt! Medic!"</sqs>
<dl class="command_description">
<!-- Note Section BEGIN -->


<!-- Note Section END -->
|x2= <sqf>
</dl>
if (damage player > 0.1) then
{
player groupChat "I'm hurt! Medic!";
};
</sqf>


<h3 style="display:none">Bottom Section</h3>
|x3= <sqf>private _health = (1 - damage player) * 100; // health in % from 0 to 100</sqf>


[[Category:Scripting Commands OFP 1.96|{{uc:{{PAGENAME}}}}]]
|seealso= [[setDamage]] [[setHit]] [[getHit]] [[getHitIndex]] [[setHitIndex]] [[getHitPointDamage]] [[setHitPointDamage]] [[waterDamaged]] [[Arma 3: Event Handlers#HandleDamage|"HandleDamage" Event Handler]]
[[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}}}}]]


<!-- CONTINUE Notes -->
{{Note
<dl class="command_description">
|user= Pierre MGI
<dd class="notedate">Posted on February 13, 2015 - 20:20 (UTC)</dd>
|timestamp= 20150213202000
<dt class="note">[[User:Pierre MGI|Pierre MGI]]</dt>
|text= 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.
<dd class="note">
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.
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.
If you script, use instead the [[getHitPointDamage]] command.
</dd>
}}
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 11:44, 5 May 2024

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!"
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:
setDamage setHit getHit getHitIndex setHitIndex getHitPointDamage setHitPointDamage waterDamaged "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
Pierre MGI - c
Posted on Feb 13, 2015 - 20:20 (UTC)
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.