View Single Post
02-01-16, 04:14 AM   #3
13ulbasaur
A Deviate Faerie Dragon
 
13ulbasaur's Avatar
Join Date: May 2013
Posts: 14
Originally Posted by SDPhantom View Post
This is just raw Lua code you can run to accomplish this.
Lua Code:
  1. hooksecurefunc("UnitFrameHealthBar_Update",function(bar,unit)
  2.     if bar and not bar.lockValues then
  3.         local cur,_,max=bar:GetValue,bar:GetMinMaxValues();
  4.         local r,g,b=1,0,0;--    Default red for both bar and text
  5.  
  6.         if cur/max>0.3 then r,g,b=0,1,0; end--  Green bar if >30%
  7.         if not bar.disconnected and not bar.lockColor then bar:SetStatusBarColor(r,g,b); end
  8.  
  9.         if cur/max>0.3 or bar.isZero then r,g,b=1,1,1; end--    White text if dead or >30%
  10.         if bar.TextString then bar.TextString:SetTextColor(r,g,b); end
  11.         if bar.LeftText then bar.LeftText:SetTextColor(r,g,b); end
  12.         if bar.RightText then bar.RightText:SetTextColor(r,g,b); end
  13.     end
  14. end);




That's pretty much how mine looks all the time. I still use the default UI with Frankenstein bits and pieces of code I added.
Hey thanks for this! I appreciate it. However, in all of my noobity, I'm not completely sure how to use it. I tried sticking the code into a custom LUA box for text in stuf but nothing comes up, and I just am not sure where to put it for the bar. Do you think you could give me a little step-by-step?

Sorry! Thanks a lot. And yee frankenstein o/
  Reply With Quote