OnNPCDeath: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Info|Event|Server|1.0}} | {{Info|Event|Server|1.0}} | ||
{{FuncDescription| | {{FuncDescription|Event thats called when a NPC dies.}} | ||
{{FuncSyntax|OnNPCDeath(npc, player)}} | {{FuncSyntax|OnNPCDeath(npc, player)}} | ||
Line 10: | Line 10: | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua"> | |||
AddEvent("OnNPCDeath", function(npcId, playerId) | |||
if playerId != 0 then | |||
-- If the death is inspected by a real player | |||
end | |||
end) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
{{ | {{Template:NPCEvents}} |
Latest revision as of 07:09, 13 December 2019
Description
Event thats called when a NPC dies.
Syntax
OnNPCDeath(npc, player)
Parameters
- npc
The npc that died. - player
Instigator, 0 if not killed by a player.
Example
AddEvent("OnNPCDeath", function(npcId, playerId)
if playerId != 0 then
-- If the death is inspected by a real player
end
end)