Base Damageable
Base class for all Damageable entities. It provides Health and Damage related methods and events.
Base ClassAPI Source
๐ชBase Class
This is a Base Class, an abstract definition that shares common methods and events with it's child classes. You cannot spawn it, and you cannot call anything on the Base Class name itself. Use any class that inherits it.
Classes that share methods and events from this Base Class: Character, CharacterSimple, VehicleWheeled, VehicleWater.
Classes that share methods and events from this Base Class: Character, CharacterSimple, VehicleWheeled, VehicleWater.
๐ฆ ย Functionsโ
| Returns | Name | Description | |
|---|---|---|---|
| integer | ApplyDamage | Do damage to this entity | |
| float | GetDamageMultiplier | Gets the Damage Multiplier of a bone | |
| integer | GetHealth | Gets the current health | |
| integer | GetMaxHealth | Gets the Max Health | |
| boolean | IsDead | Returns if the entity is dead | |
Respawn | Respawns the Entity, filling its Health and moving it to its Initial Location | ||
SetDamageMultiplier | Changes how much damage this entity takes on specific bones | ||
SetHealth | Sets the Health of this Entity | ||
SetMaxHealth | Sets the MaxHealth of this Entity |
Moderate

ApplyDamageโ
Do damage to this entity, will trigger all related events and apply modified damage based on bone. Also will apply impulse if it's a heavy explosion
local ret = my_damageable:ApplyDamage(damage, bone_name?, damage_type?, from_direction?, instigator?, causer?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| integer | damage | Required parameter | No description provided |
| string | bone_name? | | No description provided |
| DamageType | damage_type? | DamageType.Shot | No description provided |
| Vector | from_direction? | Vector(0, 0, 0) | No description provided |
| Player | instigator? | nil | The player which caused the damage |
| any | causer? | nil | The object which caused the damage |
Returns
| Type | Description |
|---|---|
| integer | the damage applied |
Optimal

GetDamageMultiplierโ
Gets the Damage Multiplier of a bone
local multiplier = my_damageable:GetDamageMultiplier(bone_name)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | bone_name | Required parameter | No description provided |
Returns
| Type | Description |
|---|---|
| float | the damage multiplier of the bone |
See also SetDamageMultiplier.
Optimal

GetHealthโ
Gets the current health
local health = my_damageable:GetHealth()
Returns
| Type | Description |
|---|---|
| integer | health |
See also SetHealth.
Optimal

GetMaxHealthโ
Gets the Max Health
local max_health = my_damageable:GetMaxHealth()
Returns
| Type | Description |
|---|---|
| integer | max_health |
See also SetMaxHealth.
Optimal

IsDeadโ
Returns if the entity is dead
local is_dead = my_damageable:IsDead()
Returns
| Type | Description |
|---|---|
| boolean | is_dead |
Moderate

Respawnโ
Respawns the Entity, filling its Health and moving it to its Initial Location
my_damageable:Respawn(location?, rotation?)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| Vector | location? | initial location | If not passed will use the initial location passed when the Entity spawned |
| Rotator | rotation? | Rotator(0, 0, 0) | No description provided |
Optimal

SetDamageMultiplierโ
Changes how much damage this entity takes on specific bones
my_damageable:SetDamageMultiplier(bone_name, multiplier)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| string | bone_name | Required parameter | No description provided |
| float | multiplier | Required parameter | No description provided |
See also GetDamageMultiplier.
Optimal

SetHealthโ
Sets the Health of this Entity. You can only call it on alive Entities (call Respawn first)
my_damageable:SetHealth(new_health)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| integer | new_health | Required parameter | No description provided |
See also GetHealth.
Optimal

SetMaxHealthโ
Sets the MaxHealth of this Entity
my_damageable:SetMaxHealth(max_health)
Parameters
| Type | Parameter | Default | Description |
|---|---|---|---|
| integer | max_health | Required parameter | No description provided |
See also GetMaxHealth.
๐ย Eventsโ
| Name | Description | |
|---|---|---|
Death | When Entity Dies | |
HealthChange | When Entity has its Health changed, or because took damage or manually set through scripting or respawning | |
Respawn | When Entity Respawns | |
TakeDamage | Triggered when this Entity takes damage |

Deathโ
When Entity Dies
<AnyDamageableClass>.Subscribe("Death", function(self, last_damage_taken, last_bone_damaged, damage_type_reason, hit_from_direction, instigator, causer)
-- Death was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Damageable | self | No description provided |
| integer | last_damage_taken | No description provided |
| string | last_bone_damaged | No description provided |
| DamageType | damage_type_reason | No description provided |
| Vector | hit_from_direction | No description provided |
| Player or nil | instigator | No description provided |
| Base Actor or nil | causer | The object which caused the damage |

HealthChangeโ
When Entity has its Health changed, or because took damage or manually set through scripting or respawning
<AnyDamageableClass>.Subscribe("HealthChange", function(self, old_health, new_health)
-- HealthChange was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Damageable | self | No description provided |
| integer | old_health | No description provided |
| integer | new_health | No description provided |

Respawnโ
When Entity Respawns
<AnyDamageableClass>.Subscribe("Respawn", function(self)
-- Respawn was called
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Damageable | self | No description provided |

TakeDamageโ
Triggered when this Entity takes damage
Return the multiplier to the final damage. Return0to cancel the damage (will still display animations, particles and apply impact forces). The default1.0.
<AnyDamageableClass>.Subscribe("TakeDamage", function(self, damage, bone, type, from_direction, instigator, causer)
-- TakeDamage was called
return 1.0
end)
Arguments
| Type | Argument | Description |
|---|---|---|
| Base Damageable | self | No description provided |
| integer | damage | No description provided |
| string | bone | Damaged bone |
| DamageType | type | Damage Type |
| Vector | from_direction | Direction of the damage relative to the damaged actor |
| Player | instigator | The player which caused the damage |
| any | causer | The object which caused the damage |

