View Full Version : Colors of hp/mana bars
Muriana
06-30-2006, 11:55 AM
Is there a way to change them? I'd like the mana bars on my unit frames to be a bit darker shade of blue. Thanks for any help!
Eledhwen
06-30-2006, 04:06 PM
Really interested in changing colors too... cannot find where to modify the .lua file :confused:
loaded123
06-30-2006, 04:48 PM
I'd also like to know this. It's pretty hard to see the hp/mp text as is.
In Layout.lua, at approximately line 73 you will find
Nurfed_Unit_mp = {
Below that (~line 79) you will find
bg = {
Within that piece of code you will find
VertexColor = { 0, 1, 1, 0.25 },
Those numbers are { r , g , b , a } and are what you want to modify, but they're not your normal 1 to 255 scale, they're 0 to 1 (decimal scale). If you want to adjust them, just modify those numbers as appropriate; you can use fractions if you're used to 1 to 255 scale, a la 100/255.
loaded123
06-30-2006, 04:52 PM
If someone could post some actual numbers to try that make the hp/mp numbers more visible I'd appreciate it.
Eledhwen
07-01-2006, 03:15 AM
I cannot find where to modify the .lua for altering the mana bar colors...
Nurfed_Unit_mp = {
type = "StatusBar",
FrameStrata = "LOW",
Orientation = "HORIZONTAL",
StatusBarTexture = NRF_IMG.."statusbar6.tga",
children = {
bg = {
type = "Texture",
layer = "BACKGROUND",
Texture = NRF_IMG.."statusbar6.tga",
VertexColor = { 0, 1, 1, 0.25 },
Anchor = "all" },
This section is regarding BG (background) and modifying that values of VertexColor doesn't seem to work at all. I'm wondering where can I find something like "StatusBarColor" somewhere...
EDIT: I found this in lib.lua
function Nurfed_UnitFrames:UpdateManaColor()
local bar = getglobal(this:GetName().."mp");
local bg = getglobal(this:GetName().."mpbg");
local color = ManaBarColor[UnitPowerType(this.unit)];
if (bar) then
bar:SetStatusBarColor(color.r, color.g, color.b);
end
if (bg) then
bg:SetVertexColor(color.r, color.g, color.b);
end
self:UpdateInfo("mp");
end
Now I don't find the definition of ManaBarColor[]... can someone give me a hint? ^^
Muriana
07-01-2006, 11:40 AM
Yeah, I tried that too and it only changed the background. :\
I wanted to to the same, and i modified the function that Eledhwen put here. I changed it to something like this:
function Nurfed_UnitFrames:UpdateManaColor()
local bar = getglobal(this:GetName().."mp");
local bg = getglobal(this:GetName().."mpbg");
local color = ManaBarColor[UnitPowerType(this.unit)];
if (bar) then
if (color.b==1) then
bar:SetStatusBarColor(color.r/1.5, color.g/1.5, color.b);
else
bar:SetStatusBarColor(color.r, color.g, color.b);
end
--bar:SetStatusBarColor(0,0,1);
end
if (bg) then
bg:SetVertexColor(color.r, color.g, color.b);
end
self:UpdateInfo("mp");
end
I make the r and g components of the color a bit smaller by dividing them by 1.5. i tried doing a flat 0,0,1 but the blue is too dark that way. Hope this helps.
Eledhwen
07-02-2006, 05:25 AM
I wanted to to the same, and i modified the function that Eledhwen put here. I changed it to something like this:
function Nurfed_UnitFrames:UpdateManaColor()
local bar = getglobal(this:GetName().."mp");
local bg = getglobal(this:GetName().."mpbg");
local color = ManaBarColor[UnitPowerType(this.unit)];
if (bar) then
if (color.b==1) then
bar:SetStatusBarColor(color.r/1.5, color.g/1.5, color.b);
else
bar:SetStatusBarColor(color.r, color.g, color.b);
end
--bar:SetStatusBarColor(0,0,1);
end
if (bg) then
bg:SetVertexColor(color.r, color.g, color.b);
end
self:UpdateInfo("mp");
end
I make the r and g components of the color a bit smaller by dividing them by 1.5. i tried doing a flat 0,0,1 but the blue is too dark that way. Hope this helps.
Great ^^ The trick works but It would be better to find out where ManaBarColor[] is defined... I guess this way you mess with the color of Rogue and Warriors 'mana'... (energy and rage colors will be altered this way)
Anyone can point where this damn array is? :p
loaded123
07-02-2006, 05:45 AM
I wanted to to the same, and i modified the function that Eledhwen put here. I changed it to something like this:
function Nurfed_UnitFrames:UpdateManaColor()
local bar = getglobal(this:GetName().."mp");
local bg = getglobal(this:GetName().."mpbg");
local color = ManaBarColor[UnitPowerType(this.unit)];
if (bar) then
if (color.b==1) then
bar:SetStatusBarColor(color.r/1.5, color.g/1.5, color.b);
else
bar:SetStatusBarColor(color.r, color.g, color.b);
end
--bar:SetStatusBarColor(0,0,1);
end
if (bg) then
bg:SetVertexColor(color.r, color.g, color.b);
end
self:UpdateInfo("mp");
end
I make the r and g components of the color a bit smaller by dividing them by 1.5. i tried doing a flat 0,0,1 but the blue is too dark that way. Hope this helps.
Thx, this worked for me. Now is there anyway you can do the same thing for the hp bar?
Eledhwen
07-02-2006, 05:53 AM
Thx, this worked for me. Now is there anyway you can do the same thing for the hp bar?
Didn't you notice something different in rogue/warriors 'mana'? They should have changed too... and that's the downside of the trick :(
damme
07-02-2006, 07:22 AM
The manabarcolor is defined in Nurfed_General.lua on this row:
ManaBarColor[0] = { r = 0.00, g = 1.00, b = 1.00, prefix = TEXT(MANA) };
Changing this shouldn't affect the other power types. If you want to change them, simply add more rows with the correct index for the power type. For a list of power types and their indexes look at this page http://www.wowwiki.com/API_UnitPowerType .
Eledhwen
07-02-2006, 07:28 AM
The manabarcolor is defined in Nurfed_General.lua on this row:
ManaBarColor[0] = { r = 0.00, g = 1.00, b = 1.00, prefix = TEXT(MANA) };
Changing this shouldn't affect the other power types. If you want to change them, simply add more rows with the correct index for the power type. For a list of power types and their indexes look at this page http://www.wowwiki.com/API_UnitPowerType .
Thanks a lot :)
hey, nice answer damme. works much better now.
and for the rest, that's why i added an if (color.b==1), because the mana bar would be the only one with full blue component, red has only red :P and yellow is red and green afaik. i think the energy and rage bars didn't change their color on my screen.
^^
loaded123
07-02-2006, 11:36 AM
Didn't you notice something different in rogue/warriors 'mana'? They should have changed too... and that's the downside of the trick :(
Well I don't play a warrior or rogue, but while targetting a warrior, the rage bar is very visible with the contrast in the red and white text. The energy (yellow) might be a different story however.
I'm still trying to find out how to do the same thing for the hp bar tho. The mana bar thing worked and looks great, but the hp bar text isn't very visible, a darker hp bar such as what he did with the mana bar would help.
Muriana
07-02-2006, 12:16 PM
Thanks, Damme. Worked like a charm.
loaded123
07-04-2006, 10:38 AM
Well I don't play a warrior or rogue, but while targetting a warrior, the rage bar is very visible with the contrast in the red and white text. The energy (yellow) might be a different story however.
I'm still trying to find out how to do the same thing for the hp bar tho. The mana bar thing worked and looks great, but the hp bar text isn't very visible, a darker hp bar such as what he did with the mana bar would help.
Anyway to do this?
damme
07-05-2006, 03:28 AM
The HP color comes from the Nurfed_Utility\Nurfed_Units.lua file, in the function GetHealth.
Change the red part to get the coloring as you like.
function Nurfed_Units:GetHealth(unit)
local currhp, maxhp = UnitHealth(unit), UnitHealthMax(unit);
if (not UnitIsConnected(unit)) then
currhp = 0;
end
local perc = currhp/maxhp;
local color = {};
if(perc > 0.5) then
color.r = (1.0 - perc) * 2;
color.g = 1.0;
else
color.r = 1.0;
color.g = perc * 2;
end
color.b = 0.0;
perc = format("%.0f", floor(perc * 100));
return currhp, maxhp, perc, color;
end
l2uff
07-05-2006, 04:07 AM
i got the mana bars & the health bars to change perfectly.. I got confused on the rage & energy part.. can someone quote what you add & change to modify them?
edit: nevermind, I was over thinking it.. here's how for anyone having trouble
in nurfedgeneral.lua, find this string
ManaBarColor[0] = { r = 1.00, g = 1.00, b = 1.00, prefix = TEXT(MANA) };
add in this after it:
ManaBarColor[1] = { r = 1.00, g = 1.00, b = 1.00, prefix = TEXT(MANA) };
ManaBarColor[2] = { r = 1.00, g = 1.00, b = 1.00, prefix = TEXT(MANA) };
ManaBarColor[3] = { r = 1.00, g = 1.00, b = 1.00, prefix = TEXT(MANA) };
ManaBarColor[4] = { r = 1.00, g = 1.00, b = 1.00, prefix = TEXT(MANA) };
[1] = rage
[2] = focus (pet)
[3] = energy
[4] = pet happiness
edit the r,g,b to the color you want and you're done
loaded123
07-05-2006, 05:08 AM
The HP color comes from the Nurfed_Utility\Nurfed_Units.lua file, in the function GetHealth.
Change the red part to get the coloring as you like.
function Nurfed_Units:GetHealth(unit)
local currhp, maxhp = UnitHealth(unit), UnitHealthMax(unit);
if (not UnitIsConnected(unit)) then
currhp = 0;
end
local perc = currhp/maxhp;
local color = {};
if(perc > 0.5) then
color.r = (1.0 - perc) * 2;
color.g = 1.0;
else
color.r = 1.0;
color.g = perc * 2;
end
color.b = 0.0;
perc = format("%.0f", floor(perc * 100));
return currhp, maxhp, perc, color;
end
Thanks, this worked for me...
if(perc > 0.5) then
color.r = (1.0 - perc) * 2;
color.g = 1.0;
I just changed the color.g = 1.0 to color.g = 0.5
Spiricore
07-22-2006, 11:28 PM
I'm curious as to how to change the colors by adding blue in there but also preserving the color change depending on health change. It seems like whenever I change the blue value it just stays one color and never changes...any ideas?
Powered by vBulletin® Version 4.1.9 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.