fire projectile hit object event||doc135532

September 20, 2022

Format

 HIT_ENTITY
  • The class to which the function belongs:Entity

Description

This event is fired when the entity object fires a projectile that hits the object.


Context

The context content of the event

name type Description
obj1 Entity the object instance that fires the projectile
obj2 Entity the instance of the object hit by the projectile
missile Missile projectile example


Code Samples

On the server side of the entity templatemount script, register when an entity object of this type fires a projectile that hits the objectCallback, inflicts damage to the entity hit by the projectile and reduces blood

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