Page tree
Skip to end of metadata
Go to start of metadata


Introduced in

Version:1.00

Description

Description:Damages / repairs a part of an object. Damage 0 means fully functional, damage 1 means completely destroyed / dead. Trigger the Dammaged, DamagedHitPart, and Killed event handlers (see Event Handlers in the VBS3 Scripting Manual).

Syntax

Syntax:object setHit [part, damage]
Parameters:
  • object: Object - Object to apply damage to.
  • part: String - Hitpoint name to apply damage to.
  • damage: Number - Damage value to apply (0-1).
Return Value:Nothing

Examples

Examples:
vehicle player setHit ["engine", 1];

Additional Information

See also: getHit, getHitPoints, canStand, fn vbs getHitpointName
Multiplayer:
Problems:

Notes





Kronzky
Since 3.4, hitpoint can be determined via the getHitPoints commands. Before that, they would have to be looked up in the HitPoints class for the respective object, or use the list below for quick reference:


Units (pre 2.0)Units (since 2.0)
  • "body"
  • "hands"
  • "legs"
  • "HitHead"
  • "HitBody"
  • "HitHands"
  • "HitLegs"
  • "HitHandLeft"
  • "HitHandRight"
  • "HitLegLeft"
  • "HitLegRight"


  • Vehicles (may or may not exist, depending on vehicle type and configuration). Any indexes (indicated by #) will start with 1, and continue on, depending on vehicle configuration:
  • "engine"
  • "fueltank"
  • "glass_W" (W=window #, e.g. glass_1)
  • "hull"
  • "light_E_S" (E=front/rear index, S=left/right index, e.g. light_1_1)
  • "main_trav" (turret)
  • "track_T" (T=track #, e.g. track_2)
  • "wheel_A_W" (A=axle #, W=wheel #, e.g. wheel_1_2)
  • "wheel_A_W_damper" (as wheel_A_W)


Specific hitzone damages will not propagate to the unit's overall damage (i.e. if the damage to a unit's legs is set to 1, the damage for the unit itself will still return 0).