Anybody that is familiar with creating addons can possibly help me?.
I’m attempting to make what i though would be a simple addon to cast a random emote on an opposite factions dead body after you kill them.
Heres what i got so far:
[CODE] local EventFrame = CreateFrame(“Frame”)
EventFrame:RegisterEvent(“PLAYER_REGEN_DISABLED”)
local emo = {
[1] = “KISS”,
[2] = “CLAP”,
[3] = “BOW”,
[4] = “HUG”,
[5] = “LICK”,
[6] = “FLEX”,
[7] = “CRY”,
[8] = “SPIT”,
}
local tracker
local playerid
EventFrame:SetScript(“OnEvent”, function(self, event, …)
if event == “PLAYER_REGEN_DISABLED” then
playerid = UnitGUID(“player”)
SetUpTracker()
end
end)
local function SetUpTracker()
tracker = CreateFrame(“Frame”)
tracker:RegisterEvent(“COMBAT_LOG_EVENT”)
tracker:SetScript(“OnEvent”, function(_, _, _, event, _, guid, _, _, _, _, destName, destFlags)
if event == “UNIT_DIED” and guid==playerid and bit.band(destFlags, COMBATLOG_OBJECT_TYPE_PLAYER) > 0 then
DoEmote(emo[random(1,8)], “none”)
end
end)
end [/CODE]
Long shot but if somebody could tell me where it went wrong, would be appreciated.