DamageableComponentis a component which defines properties, events, and functions for objects which take damage. You can only apply this API to both a player and a non-player character (NPC). To convert an object to an NPC, attach a Character or Monster component to it.
DamageableComponentcan only function when the Damageable module (https://developer.yahaha.com/manual/yahaha-studio-manual/scripting/module/module-reference/Damageable/) is added to the same object.
Current amount of hit points.
Maximum amount of hit points.
void ApplyDamage(number amount, [YaEntity enemy])¶
Damages the damageable object.
amountindicates the numeric amount of damage to inflict. If it is negative, the object will be healed.
enemyidentifies the one who caused the damage or heal. It will be sent to
Fired when the damageable object takes damage.
damageInfoIncluding information about damage/healing
Fired when the hit points are decreased to zero.