setHit: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Note moved to talk)
Line 19: Line 19:
|p1 = [part, damage, useEffects]: [[Array]] |Parameter1=
|p1 = [part, damage, useEffects]: [[Array]] |Parameter1=


|p2= object: [[Object]] - |PARAMETER2=
|p2= object: [[Object]] - [[local]] object|PARAMETER2=


|p3= part: [[String]] - Name of the part ([[Named_Selection|selection]] name) |Parameter3=
|p3= part: [[String]] - Name of the part ([[Named_Selection|selection]] name) |Parameter3=
Line 54: Line 54:
[[hint]] [[str]] ([[damage]] [[player]]); {{cc|will return 0}}</code>
[[hint]] [[str]] ([[damage]] [[player]]); {{cc|will return 0}}</code>


<dd class="notedate">
<dt class="note">[[User:DenV|denisko.redisko]]
<dd class="note">Direct use of the names of sections of the model is likely a bad practice, and will not work on some addons.
So instead:
<code>_MH60S [[setHit]] ["elektronika", _hit];</code>
should be used:
<code>_MH60S [[setHit]] [<nowiki/>[[getText]] ([[configFile]] >> "cfgVehicles" >> "MH60S" >> "HitPoints" >> "HitAvionics" >> "name"), _hit];</code>
<dd class="notedate">
<dt class="note">[[User:LongEnoughName|Sa-Matra]]
<dd class="note">Since there is no [[getHit]] (as of A2OA 1.61), you can use [[canMove]] command to check if vehicle is capable of moving.<br>
For land wheeled vehicles canMove will return false if any real wheel (damaging nonexistent wheels doesn't count) has hitpoint damage greater than 0.9.
Having HitEngine damage greater than 0.9 will make canMove to return false as well (plus will result in vehicle exploding).
HitFuel however doesn't make canMove return false even though having high HitFuel damage will make car explode.<br>
For helicopters HitEngine with damage greater than 0.9 will make [[canMove]] return false as well. Having HitHRotor (main rotor) damaged even up to 1 will never make canMove return false. However, if HitVRotor (tail rotor) will have damage greater than 0.703608 it will make [[canMove]] return false (even though some helicopters are controllable and flyable by player with broken tail rotor).<br>
You can use [[canFire]] the same way in order to check if turret hitpoints are not damaged enough to be able to fire. ([[canFire]] always returns [[false]] if there is no gunner in the vehicle).
'''Update:''' Since ArmA 3 1.31 [[getHit|getHit]] has been introduced.


<!-- Note Section END -->
</dl>
</dl>



Revision as of 12:38, 19 September 2019

Hover & click on the images for description

Description

Description:
Set damage on a part of an object.
Some part names are in Czech; see translation table.
Groups:
Uncategorised

Syntax

Syntax:
object setHit [part, damage, useEffects]
Parameters:
[part, damage, useEffects]: Array
object: Object - local object
part: String - Name of the part (selection name)
damage: Number - Damage value ranging 0..1, 0 being fully functional, 1 being destroyed
Arma 3 logo black.png1.67 useEffects: Boolean - (Optional, default true) false to skip destruction effects
Return Value:
Nothing

Examples

Example 1:
vehicle player setHit ["motor", 1];
Example 2:
vehicle player setHit ["mala vrtule", 0.95];
Example 3:
if (local _heli) then { _heli setHit ["velka vrtule", 0]; } else { hint ("Vehicle " + str _heli + " must be local to this machine to do that!"); };

Additional Information

See also:
getHitgetHitPointDamagesetHitPointDamagedamagesetDamagesetFuelsetAmmogetHitIndexsetHitIndex

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

Deadfast
Damaging specific parts of the vehicle will not update its overall damage value (as of v1.03): player setHit ["hands", 0.9]; hint str (damage player); // will return 0

Bottom Section

Posted on September 11, 2018 - 19:37 (UTC)
HazJ
You can use getHit if you are using 1.64 EOL version.