local HandleNPCID = 0 -- the npcid of the creature who handles the event
local Lord = {}
local i = 0
function HandlerSpawns_SpawnEvent(pUnit)
Lord.Emperor = pUnit:GetUnitBySqlId(-1828716470) -- each of those ID's is the GUID of the creature we want to use
Lord.Counciler1 = pUnit:GetUnitBySqlId(-187904813
-- Smily face is actually "8 )" but without a space in-between
Ulda.dwarfb = pUnit:GetUnitBySqlId(9271261)
Ulda.dwarfc = pUnit:GetUnitBySqlId(9271260)
Ulda.ballista = pUnit:GetUnitBySqlId(9271324)
Ulda.main = pUnit:GetUnitBySqlId(9271616) -- each of these ID's is the GUID of the creature we want to use
i = 0 -- reset our variable
pUnit:RegisterEvent("SayAMessageAndRepeat_OneTwo", 5000, 1)
end
function SayAMessageAndRepeat_OneTwo(pUnit)
i = i + 1 -- always add to i each time this function is called
if i == 1 then -- first time
Lord.Emperor:SendChatMessage(12,0,"Hi!") -- Get our guy and send a message
Lord.Emperor:SendChatMessage(1,4000) -- say emote
pUnit:RegisterEvent("SayAMessageAndRepeat_OneTwo", 5000, 1) -- send next message in 5 seconds
elseif i == 2 then
Lord.Counciler1:SendChatMessage(12,0,"Hello.") -- different creature
Lord.Counciler1:Emote(1, 4000) -- say emote
pUnit:RegisterEvent("SayAMessageAndRepeat_OneTwo", 1000, 1) -- do next part in a second
elseif i == 3 then
i = 0 -- reset our event to repeat
pUnit:RegisterEvent("SayAMessageAndRepeat_OneTwo", 60000*30, 1) -- 60 seconds * 30 = 30 minutes
end
end
RegisterUnitEvent(HandleNPCID, 18, "HandlerSpawns_SpawnEvent")