setHit

From Bohemia Interactive Community
Revision as of 18:57, 20 January 2017 by Killzone Kid (talk | contribs)
Jump to navigation Jump to search
Hover & click on the images for description

Description

Description:
Damage / repair part of object. The object must be local to the computer where command is executed. Damage 0 means fully functional, damage 1 means completely destroyed / dead. Note: 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 -
part: String - Name of the part (selection name).
damage: Number -
useEffects (Optional): Boolean - false to skip destruction effects. Default: true (Since Arma 3 v1.67)
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


denisko.redisko
Direct use of the names of sections of the model is likely a bad practice, and will not work on some addons. So instead:
_MH60S setHit ["elektronika", _hit];

should be used:

_MH60S setHit [getText(configFile >> "cfgVehicles" >> "MH60S" >> "HitPoints" >> "HitAvionics" >> "name"), _hit];


Sa-Matra
Since there is no getHit (as of 1.61), you can use canMove command to check if vehicle is capable of moving. 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. 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). In same manner you can use canFire to check if turret hitpoints are not damaged enough to be able to fire. (canFire always returns false if there is nobody in vehicle) Update: Since ArmA 3 1.31 getHit has been introduced.

Bottom Section