Quantcast WoWInterface - View Single Post - Stuf + Threat
Thread: Stuf + Threat
View Single Post
06-09-11, 03:57 PM   #2
local roygbi-
Nibelheim's Avatar
Join Date: Jan 2010
Posts: 1,600
Originally Posted by Lily.Petal View Post
I am currently wanting to make a small threat meter using Stuf's custom LUA text option.

All I want it to do is just show My current Threat% (without the % sign please) on my target, the color being Stuf's HP Red Color.

If someone could offer assistance, I would appreciate it greatly!

To get an accurate % reading may be out of the scope of Lua Text, as you'd want a timer to keep threat information updated. There's a few threat events you can watch out for, but they only fire on major threat changes making them somewhat useless for watching threat closely. It may be possible to utilize Stufs own Target frame from within the Lua Text itself. A crude example being:

self.ttelapsed = 0
self:SetScript("OnUpdate", function(self, elapsed)
  self.ttelapsed = self.ttelapsed + elapsed
  if self.ttelapsed >= 0.5 then
    local _, _, threatpct, _, threatvalue = UnitDetailedThreatSituation(unitid, mobunitid)
    if threatvalue then
      return "|cffff0000%d|r", floor(threatpct)
      return ""
    self.ttelapsed = 0
  Reply With Quote