{"name":"setHitPointDamage","operator":null,"title":"setHitPointDamage","type":"command","url":"https://community.bistudio.com/wiki/setHitPointDamage","revid":369857,"updated":"2024-10-16T13:52:06Z","groups":["Object Manipulation"],"status":"ok","replaced_by":[],"games":[{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":"local","effect":"global","server_exec":false},"exec":null,"description":"| Event Handler | Triggered |\n|---|---|\n| `Hit` | ✗ |\n| `HandleDamage` | ✗ |\n| `Killed` | ✓ |\n| `MPKilled` | ✓ |\n\nSet the current level of damage for a specific Hit Point (specified by its config class). This command has no effect when allowDamage is set to false.\n\n> [!NOTE]\n> See also BIS_fnc_setHitPointDamage for setting hit with dependency.","syntaxes":[{"syntax":"vehicle setHitPointDamage [hitPointName, damage, useEffects, killer, instigator, breakRotor]","since":null,"effect":null,"exec":null,"params":[{"name":"vehicle","type":"Object","optional":false,"default":null,"description":"vehicle to be damaged","types":["Object"],"since":null,"text":"vehicle: Object - vehicle to be damaged"},{"name":"hitPointName","type":"String","optional":false,"default":null,"description":"name of the Hit Point class","types":["String"],"since":null,"text":"hitPointName: String - name of the Hit Point class"},{"name":"damage","type":"Number","optional":false,"default":null,"description":"level of damage, in range 0..1","types":["Number"],"since":null,"text":"damage: Number - level of damage, in range 0..1"},{"name":"useEffects","type":"Boolean","optional":true,"default":"true","description":"false to skip destruction effects","types":["Boolean"],"since":"arma3 1.68","text":"useEffects: Boolean - (Optional, default true) false to skip destruction effects"},{"name":"killer","type":"Object","optional":true,"default":"objNull","description":"the entity that caused the damage. If the damage leads to the death of the unit, the killer will be used as the object that caused the kill.\n\n- It can be used to show \"killed by player\" in debriefing statistics and kill messages in the chat (if death messages are enabled).\n\n- It will alter the killer's rating as if the killer directly killed the unit.\n\n- It will be listed as `_killer` parameter in the Killed event handler.","types":["Object"],"since":"arma3 2.08","text":"killer: Object - (Optional, default objNull) the entity that caused the damage. If the damage leads to the death of the unit, the killer will be used as the object that caused the kill.\n\n- It can be used to show \"killed by player\" in debriefing statistics and kill messages in the chat (if death messages are enabled).\n\n- It will alter the killer's rating as if the killer directly killed the unit.\n\n- It will be listed as `_killer` parameter in the Killed event handler."},{"name":"instigator","type":"Object","optional":true,"default":"objNull","description":"the person that instigated the damage.\n- if a tank is a killer, the tank gunner that pulled the trigger is instigator\n- it will be listed as `_instigator` parameter in the Killed event handler.","types":["Object"],"since":"arma3 2.12","text":"instigator: Object - (Optional, default objNull) the person that instigated the damage.\n- if a tank is a killer, the tank gunner that pulled the trigger is instigator\n- it will be listed as `_instigator` parameter in the Killed event handler."},{"name":"breakRotor","type":"Boolean","optional":true,"default":"false","description":"if the hitpoint is rotor on a helicopter, true will break the rotor as well as play corresponding sound if 'useEffects' is also true.","types":["Boolean"],"since":"arma3 2.18","text":"breakRotor: Boolean - (Optional, default false) if the hitpoint is rotor on a helicopter, true will break the rotor as well as play corresponding sound if 'useEffects' is also true."}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"vehicle","types":["Object"]},"right":{"text":"[hitPointName, damage, useEffects, killer, instigator, breakRotor]","types":["Array"]}}],"examples":[{"text":"```sqf\nvehicle player setHitPointDamage [\"hitEngine2\", 1.0];\n```","code":["vehicle player setHitPointDamage [\"hitEngine2\", 1.0];"]},{"text":"```sqf\nplayer setHitPointDamage [\"hitHead\", 0.5];\nplayer setHitPointDamage [\"hitBody\", 0.5];\nplayer setHitPointDamage [\"hitHands\", 0.5];\nplayer setHitPointDamage [\"hitLegs\", 0.5];\n```","code":["player setHitPointDamage [\"hitHead\", 0.5];\nplayer setHitPointDamage [\"hitBody\", 0.5];\nplayer setHitPointDamage [\"hitHands\", 0.5];\nplayer setHitPointDamage [\"hitLegs\", 0.5];"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["getHitPointDamage","getAllHitPointsDamage","setHit","getHit","setDamage","damage","getHitIndex","setHitIndex","forceHitPointsDamageSync","BIS_fnc_setHitPointDamage"],"notes":[{"user":"Master85","date":"2012-08-30T13:54:00Z","text":"This command is using the Hit Points (defined in the `HitPoints` class in the config) while setHit is using Named Selections (defined in the model itself)."}],"categories":["Arma 3: Scripting Commands","Command Group: Object Manipulation","Introduced with Take On Helicopters version 1.00","Scripting Commands","Scripting Commands: Global Effect","Take On Helicopters: New Scripting Commands","Take On Helicopters: Scripting Commands"]}