hit by projectile||doc135531

September 20, 2022

Format

 ENTITY_HITTED
  • The class to which the function belongs:Entity

Description

This event is fired when a solid object is hit by a projectile.


Context

The context content of the event

name type Description
obj1 Entity Object hit by projectile
obj2 Entity the object that fires the projectile
missile Missile projectile object


Code Samples

On the server side of the entity templatemount script, register when the entity object of this class is hit by a projectileCallback, inflicts damage to the entity hit by the projectile and reduces blood

Trigger.RegisterHandler(this:cfg(), "ENTITY_HITTED", function(context)
    local target = context.obj1
    local from = context.obj2
    local missile = context.missile
    target:takeDamage(10, from, false, '')           --Inflict damage
end)