WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Extract id of a killed npc (https://www.wowinterface.com/forums/showthread.php?t=55716)

maqjav 09-04-17 08:37 AM

Extract id of a killed npc
 
Hello.

I'm trying to extract the NPC ID of a npc I just killed (when I'm in a group).

I have the next code:

Code:

myFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
myFrame:SetScript("OnEvent", function(self, event, ...)
        if (event == "COMBAT_LOG_EVENT_UNFILTERED") then
                local timestamp, eventType, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = ...
                if (eventType == "PARTY_KILL" or eventType == "UNIT_DIED") then
                        local _, _, _, _, _, id = strsplit("-", destGUID)
                        print("ID found "..id)
                end
        end
end)

This works sometimes... a lot of times the event is not fired.

Do you know if there are some limitations with this events or if I'm doing something wrong?

Thanks


All times are GMT -6. The time now is 04:40 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI