Hit by a ray skill||doc135534

September 20, 2022


  • The class to which the function belongs:Entity


This event is fired when an entity object is hit by a ray skill.


The context content of the event

name type Description
obj1 Entity Object hit by projectile
obj2 Entity the object that fires the projectile
hitHead boolean whether to hit the head

Code Samples

On the server side of the entity templatemount script, register when this type of entity object is hit by a ray skillCallback, wounding the hit entity, andbroadcast tipshit relationship

Trigger.RegisterHandler(this:cfg(), "ENTITY_HITTED_BY_RAY", function(context)
    local target = context.obj1
    local from = context.obj2
    target:takeDamage(10, from, false, '')                               --Inflict damage
    World.CurWorld.SystemNotice(1, from.name..' hit '..target.name, 40)  --Broadcast