View Single Post
08-05-17, 09:43 AM   #4
pas06
A Theradrim Guardian
Join Date: Apr 2009
Posts: 62
Sorry, but i don't understand what you wanted to do with COMBAT_LOG_EVENT_UNFILTERED.
I also don't understand what you are tying todo with your table moblist. If you want the desired mobnames in a table its better to just make the table like
Lua Code:
  1. local mobs = {
  2. ["Eredar Summoner"] = true,
  3. ["Wrathguard Dreadblade"] = true,
  4. }
This way you can easily check if the new added nameplate belongs to a unit whose name is in your table.

Exmaple Code:
Lua Code:
  1. local moblist = {
  2.     ["Eredar Summoner"] = true,
  3.     ["Wrathguard Dreadblade"] = true,
  4. }
  5.  
  6.  
  7.  
  8.  
  9. local frame = CreateFrame("frame")
  10. frame:RegisterEvent("NAME_PLATE_UNIT_ADDED")
  11. frame:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
  12. frame:SetScript("OnEvent", function(self, event, ...)
  13. if event == "NAME_PLATE_UNIT_ADDED" then
  14.     local unitID = ...
  15.     if moblist[UnitName(unitID)] then-- modify his nameplates
  16.         local nameplate = C_NamePlate.GetNamePlateForUnit(unitID)
  17.         if not nameplate.myIndicator then
  18.             nameplate.myIndicator = nameplate:CreateTexture(nil, "OVERLAY")
  19.             nameplate.myIndicator:SetTexture("whatEverTextureYouLike")
  20.         end
  21.         nameplate.myIndicator:Show()
  22.     end
  23.  
  24. elseif event == "NAME_PLATE_UNIT_REMOVED" then
  25.         local unitID = ...
  26.     local nameplate = C_NamePlate.GetNamePlateForUnit(unitID)
  27.     if nameplate.myIndicator then
  28.         nameplate.myIndicator:Hide()
  29.     end
  30. end
  31.  
  32.  
  33. end)
  Reply With Quote