View Single Post
09-28-16, 12:19 PM   #2
Sweetsour
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Dec 2014
Posts: 130
Well, UNIT_AURA fires when a unit's auras have changed. So when this fires, it sends you the unit that caused the event to fire. So you'd want to try something like this:

Lua Code:
  1. textFrame:HookScript("OnEvent", function(self, event, ...) -- Use "HookScript" instead
  2.  
  3.  
  4.     if (event == "UNIT_AURA") then -- need to check to only run this code when the event fired is "UNIT_AURA"
  5.         local unit = select(1,...) -- UNIT_AURA returns one arg; being the unit
  6.         local count = 0
  7.      
  8.         if (unit and unit ~= "player") then
  9.             return
  10.         end
  11.  
  12.  
  13.         --  Check player buffs against the roll the bones buffs
  14.         for buff in pairs(buffs) do
  15.             if UnitBuff("player", buff) then
  16.                 count = count + 1
  17.             end
  18.         end
  19.  
  20.         --  Give warning if need to reroll the bones
  21.         if UnitBuff("player", "True Bearing") or UnitBuff("player", "Shark Infested Waters") or count >= 2 then
  22.             textFrame:message("")
  23.         else
  24.             textFrame:message("ROLL THE BONES!!")
  25.         end
  26.     end
  27.  
  28.  
  29.  end)

Last edited by Sweetsour : 09-28-16 at 12:29 PM.
  Reply With Quote