cause some damages||doc135510

September 20, 2022

Format

 Entity:takeDamage(damage, from, isFormula, cause) 
  • The class to which the function belongs:Entity

Description

Inflicts damage to solid objects.


Parameters

Variable name type Description
damage int damage
from Entity Damage source entity instance
isFormula boolean Whether to enable the default damage formula
cause strin Description of the source of damage


Code Samples

On the server side of the entity templatemount script, add a register for when this type of entity is hit by a projectileCallback,cause some damages

Trigger.RegisterHandler(this:cfg(), "ENTITY_HITTED", function(context)
    local entity = context.obj1
    local from = context.obj2
    entity:takeDamage(10, from, false, '') 
end)