View Single Post
09-04-17, 08:37 AM   #1
maqjav
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Feb 2012
Posts: 60
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

Last edited by maqjav : 09-04-17 at 09:27 AM.
  Reply With Quote