OnNPCDeath: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
Line 1: Line 1:
{{Info|Event|Server|1.0}}
{{Info|Event|Server|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Event thats called when a NPC dies.}}


{{FuncSyntax|OnNPCDeath(npc, player)}}
{{FuncSyntax|OnNPCDeath(npc, player)}}
Line 10: Line 10:


== Example ==
== Example ==
__EDIT_ME__
<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}}
{{ServerEvents}}
{{Template:NPCEvents}}

Revision as of 07:08, 13 December 2019

OnNPCDeath

Type: Event
Context: Server
Introduced: v1.0

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

<syntaxhighlight lang="Lua"> AddEvent("OnNPCDeath", function(npcId, playerId)

   if playerId != 0 then
       -- If the death is inspected by a real player
   end

end) <syntaxhighlight>

See also