damage: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "[[Category:Scripting_Commands_Take_On_Helicopters" to "[[Category:Scripting Commands Take On Helicopters")
Line 12: Line 12:
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[Number]] <nowiki>=</nowiki> '''damage''' object |SYNTAX=
| [[damage]] object |SYNTAX=


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


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


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


Line 40: Line 38:
<h3 style="display:none">Bottom Section</h3>
<h3 style="display:none">Bottom Section</h3>


[[Category:Scripting Commands|DAMAGE]]
[[Category:Scripting Commands OFP 1.96|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands OFP 1.99|DAMAGE]]
[[Category:Scripting Commands OFP 1.99|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands OFP 1.96|DAMAGE]]
[[Category:Scripting Commands ArmA|DAMAGE]]
[[Category:Scripting Commands ArmA|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Object_Information|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group: Object Information|{{uc:{{PAGENAME}}}}]]


<!-- CONTINUE Notes -->
<!-- CONTINUE Notes -->
Line 55: Line 51:
<dt class="note">[[User:Pierre MGI|Pierre MGI]]</dt>
<dt class="note">[[User:Pierre MGI|Pierre MGI]]</dt>
<dd class="note">
<dd class="note">
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 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.
</dd>
</dd>
</dl>
</dl>
<!-- DISCONTINUE Notes -->
<!-- DISCONTINUE Notes -->

Revision as of 00:34, 18 May 2020

Hover & click on the images for description

Description

Description:
Return the damage value of an object.
Groups:
Uncategorised

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

Notes

Bottom Section

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.