OnNPCDeath: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Event|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|OnNPCDeath}} {{FuncParameters}} == Example == __EDIT_ME__ {{RelatedFunctions}} {{ServerEvents}}" |
No edit summary |
||
(2 intermediate revisions by 2 users 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}} | {{FuncSyntax|OnNPCDeath(npc, player)}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|npc|The npc that died.}} | |||
{{FuncParam|player|Instigator, 0 if not killed by a player.}} | |||
== 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)