setHit: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "|PARAMETER1= |p3=" to "|PARAMETER2= |p3=") |
Lou Montana (talk | contribs) m (Fix Category:Pages using duplicate arguments in template calls, description and comments) |
||
Line 11: | Line 11: | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| | | Set damage on a part of an object. | ||
{{Informative | Some part names are in Czech; see [[Translations|translation table]]. }} |DESCRIPTION= | |||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| object | | object [[setHit]] [part, damage, useEffects] |SYNTAX= | ||
|p1 = [part, damage, useEffects]: [[Array]] |Parameter1= | |p1 = [part, damage, useEffects]: [[Array]] |Parameter1= | ||
|p3= part: [[String]] - Name of the part ([[Named_Selection|selection]] name). | |p2= object: [[Object]] - |PARAMETER2= | ||
|p3= part: [[String]] - Name of the part ([[Named_Selection|selection]] name) |Parameter3= | |||
|p4= damage: [[Number]] - Damage value ranging 0..1, 0 being fully functional, 1 being destroyed |Parameter4= | |||
| | |p5 = {{GVI|arma3|1.67}} useEffects: [[Boolean]] - (Optional, default [[true]]) [[false]] to skip destruction effects |Parameter5= | ||
| | | [[Nothing]] |RETURNVALUE= | ||
____________________________________________________________________________________________ | |||
| [[ | |x1= <code>[[vehicle]] [[player]] [[setHit]] ["motor", 1];</code> |EXAMPLE1= | ||
|x2= <code>[[vehicle]] [[player]] [[setHit]] ["mala vrtule", 0.95];</code> |EXAMPLE2= | |||
|x3= <code>[[if]] ([[local]] _heli) [[then]] { | |x3= <code>[[if]] ([[local]] _heli) [[then]] { | ||
_heli [[setHit]] ["velka vrtule", 0]; | _heli [[setHit]] ["velka vrtule", 0]; | ||
} [[else]] { | } [[else]] { | ||
[[hint]] "Vehicle " + [[str]] _heli + " must be local to this machine to do that!"; | [[hint]] ("Vehicle " + [[str]] _heli + " must be local to this machine to do that!"); | ||
};</code> |EXAMPLE3= | };</code> |EXAMPLE3= | ||
____________________________________________________________________________________________ | ____________________________________________________________________________________________ | ||
| | | [[getHit]], [[getHitPointDamage]], [[setHitPointDamage]], [[damage]], [[setDamage]], [[setFuel]], [[setAmmo]], [[getHitIndex]], [[setHitIndex]] |SEEALSO= | ||
}} | }} | ||
Line 51: | Line 49: | ||
<dd class="notedate"> | <dd class="notedate"> | ||
<dt class="note"> | <dt class="note">[[User:Deadfast|Deadfast]] | ||
<dd class="note">Damaging specific parts of the vehicle will not update its overall [[damage]] value (as of v1.03): | <dd class="note">Damaging specific parts of the vehicle will not update its overall [[damage]] value (as of v1.03): | ||
< | <code>[[player]] [[setHit]] ["hands", 0.9]; | ||
player setHit ["hands", 0.9]; | [[hint]] [[str]] ([[damage]] [[player]]); {{cc|will return 0}}</code> | ||
hint str (damage player); | |||
</ | |||
<dd class="notedate"> | <dd class="notedate"> | ||
<dt class="note"> | <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. | <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: | So instead: | ||
< | <code>_MH60S [[setHit]] ["elektronika", _hit];</code> | ||
should be used: | should be used: | ||
< | <code>_MH60S [[setHit]] [<nowiki/>[[getText]] ([[configFile]] >> "cfgVehicles" >> "MH60S" >> "HitPoints" >> "HitAvionics" >> "name"), _hit];</code> | ||
<dd class="notedate"> | <dd class="notedate"> | ||
<dt class="note"> | <dt class="note">[[User:LongEnoughName|Sa-Matra]] | ||
<dd class="note">Since there is no getHit (as of 1.61), you can use [[ | <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. | |||
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. | 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). | 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. | '''Update:''' Since ArmA 3 1.31 [[getHit|getHit]] has been introduced. | ||
<!-- Note Section END --> | <!-- Note Section END --> | ||
Line 97: | Line 90: | ||
<dt class="note">[[User:HazJ|HazJ]]</dt> | <dt class="note">[[User:HazJ|HazJ]]</dt> | ||
<dd class="note"> | <dd class="note"> | ||
You can use getHit if you are using 1.64 EOL version. | You can use [[getHit]] if you are using 1.64 EOL version. | ||
</dd> | </dd> | ||
</dl> | </dl> | ||
<!-- DISCONTINUE Notes --> | <!-- DISCONTINUE Notes --> |
Revision as of 11:36, 19 September 2019
Description
- Description:
- Set damage on a part of an object.
- 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 - Damage value ranging 0..1, 0 being fully functional, 1 being destroyed
- 1.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
- 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 A2OA 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).
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 has been introduced.