Instantly share code, notes, and snippets.

@mindsear /example.lua Secret
Last active Feb 13, 2018

Embed
What would you like to do?
Example Eluna Creature Spawn/Despawn GameObject
-- Example Eluna Creature Spawn/Despawn GameObject
local NPC_ID = 299 -- Diseased Young Wolf
local MailBox = 195629 -- MailBox GameObject ID
local function OnEnterCombat(event, creature, target)
creature:SummonGameObject(MailBox, creature:GetX(), creature:GetY(), creature:GetZ(), creature:GetO(), 0)
creature:SendUnitSay("Spawned GameObject successfully", 0)
end
local function OnDied(event, creature, killer)
local nearestGameObject = creature:GetNearestGameObject(50, MailBox)
nearestGameObject:Despawn()
creature:SendUnitSay("Despawned GameObject successfully", 0)
end
RegisterCreatureEvent(NPC_ID, 1, OnEnterCombat)
RegisterCreatureEvent(NPC_ID, 4, OnDied)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment