Passer au contenu principal
Version: bleeding-edge 🩸

Base Damageable

Classe de base pour toutes les entités pouvant être endommagées. Elle fournit des méthodes et des événements liés à la santé et aux dégâts.

👪Base Class
This is a Base Class. Base Classes are abstract definitions used to share common methods and events between related child classes, thus you cannot spawn it directly.

Classes that share methods and events from this Base Class: Character, CharacterSimple, VehicleWheeled, VehicleWater.
🧑‍💻API Source
This page is auto-generated! The Functions, Properties and Events described here are defined in our GitHub's API Repository! Feel free to commit suggestions and changes to the source .json API files!

🦠 Functions

ReturnsNameDescription
integerApplyDamageInfliger des dégâts à cette entité
floatGetDamageMultiplierObtient le multiplicateur de dégâts d'un os
integerGetHealthObtient la santé actuelle
integerGetMaxHealthObtient la vie max
booleanIsDeadRetourne si l'entité est morte
RespawnRespawns the Entity, filling its Health and moving it to its Initial Location
SetDamageMultiplierModifie la quantité de dégâts que cette entité subit sur des os spécifiques
SetHealthDéfinit la Santé de cette Entité
SetMaxHealthDéfinit la Santé maximale de cette Entité

ApplyDamage

Inflige des dégâts à cette entité ; déclenche tous les événements associés et applique les dégâts modifiés en fonction de l'os touché. Applique également une impulsion s'il s'agit d'une forte explosion
local ret = my_damageable:ApplyDamage(damage, bone_name?, damage_type?, from_direction?, instigator?, causer?)

Parameters

TypeParameterDefaultDescription
integerdamage Required parameter No description provided
stringbone_name?No description provided
DamageTypedamage_type?DamageType.ShotNo description provided
Vectorfrom_direction?Vector(0, 0, 0)No description provided
Playerinstigator?nilThe player which caused the damage
anycauser?nilThe object which caused the damage

Returns

TypeDescription
integerle dommage appliqué

GetDamageMultiplier

Obtient le multiplicateur de dégâts d'un os
local multiplier = my_damageable:GetDamageMultiplier(bone_name)

Parameters

TypeParameterDefaultDescription
stringbone_name Required parameter No description provided

Returns

TypeDescription
floatLe multiplicateur de dégâts de l'os

See also SetDamageMultiplier.


GetHealth

Obtient la santé actuelle
local health = my_damageable:GetHealth()

Returns

TypeDescription
integerhealth

See also SetHealth.


GetMaxHealth

Obtient la vie max
local max_health = my_damageable:GetMaxHealth()

Returns

TypeDescription
integermax_health

See also SetMaxHealth.


IsDead

Retourne si l'entité est morte
local is_dead = my_damageable:IsDead()

Returns

TypeDescription
booleanis_dead

Respawn

Respawns the Entity, filling its Health and moving it to its Initial Location
my_damageable:Respawn(location?, rotation?)

Parameters

TypeParameterDefaultDescription
Vectorlocation?initial locationSi non fourni, utilisera l'emplacement initial défini lors de l'apparition de l'Entité
Rotatorrotation?Rotator(0, 0, 0)No description provided

SetDamageMultiplier

Modifie la quantité de dégâts que cette entité subit sur des os spécifiques
my_damageable:SetDamageMultiplier(bone_name, multiplier)

Parameters

TypeParameterDefaultDescription
stringbone_name Required parameter No description provided
floatmultiplier Required parameter No description provided

See also GetDamageMultiplier.


SetHealth

Définit la Santé de cette Entité. Ne peut être appelée que sur des Entités vivantes (appelez d'abord Respawn)
my_damageable:SetHealth(new_health)

Parameters

TypeParameterDefaultDescription
integernew_health Required parameter No description provided

See also GetHealth.


SetMaxHealth

Définit la Santé maximale de cette Entité
my_damageable:SetMaxHealth(max_health)

Parameters

TypeParameterDefaultDescription
integermax_health Required parameter No description provided

See also GetMaxHealth.

🚀 Events

NameDescription
Death Lorsque l'Entité meurt
HealthChangeWhen Entity has its Health changed, or because took damage or manually set through scripting or respawning
RespawnLorsque l'Entité réapparaît
TakeDamageDéclenché lorsque cette Entité subit des dégâts

Death

Lorsque l'Entité meurt
Damageable.Subscribe("Death", function(self, last_damage_taken, last_bone_damaged, damage_type_reason, hit_from_direction, instigator, causer)
-- Death was called
end)

Arguments

TypeArgumentDescription
Base DamageableselfNo description provided
integerlast_damage_takenNo description provided
stringlast_bone_damagedNo description provided
DamageTypedamage_type_reasonNo description provided
Vectorhit_from_directionNo description provided
Player or nilinstigatorNo description provided
Base Actor or nilcauserThe object which caused the damage

HealthChange

When Entity has its Health changed, or because took damage or manually set through scripting or respawning
Damageable.Subscribe("HealthChange", function(self, old_health, new_health)
-- HealthChange was called
end)

Arguments

TypeArgumentDescription
Base DamageableselfNo description provided
integerold_healthNo description provided
integernew_healthNo description provided

Respawn

Lorsque l'Entité réapparaît
Damageable.Subscribe("Respawn", function(self)
-- Respawn was called
end)

Arguments

TypeArgumentDescription
Base DamageableselfNo description provided

TakeDamage

Déclenché lorsque cette Entité subit des dégâts

Renvoie le multiplicateur appliqué aux dégâts finaux. Renvoyez 0 pour annuler les dégâts (les animations, particules et forces d'impact seront tout de même appliquées). Valeur par défaut : 1.0
Damageable.Subscribe("TakeDamage", function(self, damage, bone, type, from_direction, instigator, causer)
-- TakeDamage was called
return 1.0
end)

Arguments

TypeArgumentDescription
Base DamageableselfNo description provided
integerdamageNo description provided
stringboneDamaged bone
DamageTypetypeDamage Type
Vectorfrom_directionDirection of the damage relative to the damaged actor
PlayerinstigatorThe player which caused the damage
anycauserThe object which caused the damage