Skip to content

OnActorDeath

An actor’s health reached 0.

attacker is the player who killed it - by a blow or by the bleed they opened - or -1 for SetActorHealth(id, 0). The corpse stays until DestroyEntity - an actor has no respawn of its own; a mode creates a new one.

function OnActorDeath(id, attacker)
-- ...
end
Parameter Type
id number the actor
attacker number the killer; -1 = nobody

nothing

function OnActorDeath(id, attacker)
if attacker >= 0 then SendClientMessageToAll(COLOUR_YELLOW, GetPlayerName(attacker) .. " killed " .. GetEntityName(id)) end
SetTimer(function() DestroyEntity(id) end, 20000) -- the corpse lies twenty seconds
end

OnActorDamage · SetActorHealth · DestroyEntity · the NPC actors group of the index