Hit object event with ray skill||doc135535

September 20, 2022


  • The class to which the function belongs:Entity


This event is fired when the entity object hits the object with the ray ability.


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
hitHead boolean whether to hit the head

Code Samples

On the server side of the entity templatemount script, when registering this type of entity object hits the object with the ray skillCallback, wounding the hit entity, andbroadcast tipshit relationship

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