OnDoDamage||doc136887

September 20, 2022

Format

local event = Entity:GetEvent("OnDoDamage")

Description

Triggered event when entity casues damage to another entity.

Callback function parameters

Type Name Introduction
Entity imposer Entity that caused damage
Entity endurer Entity that took damage
table<string, variant> damageInfo Damage details

Entity that caused damage and entity that took damage may be the same entity

Code Example

local event = Event:GetEvent("OnDoDamage")
event:Bind(function(imposer, endurer, damageInfo)
    print(imposer .. " damage " .. endurer)
    print(damageInfo.damage, damageInfo.skillName, damageInfo.cause)
end)