Quantcast
Custom shapes for health bars - WoWInterface
Thread Tools Display Modes
01-12-14, 04:33 PM   #1
Uriyel
A Murloc Raider
Join Date: Jan 2014
Posts: 5
Custom shapes for health bars

I've been searching these forums for hours but unable to get a clear cut explanation on how this is done. The example that sent me searching was here.

It's mentioned that this can be achieved in pitbul and stuf. I've used pitbul in the past, but how can you use a custom image to get out of that dreaded rectangular bounding box?

Is it a trick of using two images to mask out different sections of a frame?

Unkn had a link to the most abstract bars I've ever seen.

I'd love to know how this is done.
  Reply With Quote
01-12-14, 04:53 PM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,059
You can't mask a texture. Irregular shapes are created using textures with transparent areas, they're still technically rectangular images.

SetTexCoord or scrollframes can be used to cut off the fill texture.
  Reply With Quote
01-12-14, 05:01 PM   #3
Uriyel
A Murloc Raider
Join Date: Jan 2014
Posts: 5
So it has to be scripted? I thought since they mentioned doing it with pitbull it was just some special masking technique in the TGA image like a solid knock-out color (ala GIF) around the outside of the frame.

Seerah was in that thread quote:
"You can achieve this with Stuf, as well.
All you need is to use your custom texture as the statusbar graphic."

This is why I thought it could be done without code.

Last edited by Uriyel : 01-12-14 at 05:04 PM.
  Reply With Quote
01-12-14, 05:12 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,859
If you want it to fill differently than a normal statusbar, then, yes, it does need to be scripted. Otherwise, no. Just use your texture for the statusbar.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
01-12-14, 05:57 PM   #5
Uriyel
A Murloc Raider
Join Date: Jan 2014
Posts: 5
Can you link an example or two that I can reference to figure it out? So say it's a rectangle image with rounded or 45 degree angle corners. You set a solid fill and use a line of script to erase it?
  Reply With Quote
01-12-14, 07:03 PM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,859
Again, only if you want it to fill/deplete *differently* from how a normal statusbar does (regardless of what texture is filling/depleting) do you need to code it that way. If all you want it to do is fill left-right (or up-down for vertical statusbars), then you don't need to do anything.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
01-12-14, 07:46 PM   #7
Uriyel
A Murloc Raider
Join Date: Jan 2014
Posts: 5
so the abstract bars in this image appear verticle fill and wouldn't need code?
  Reply With Quote
01-12-14, 07:57 PM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,859
This is correct.

/edit: So long as whichever unit frame addon you choose to use supports vertical statusbars and you change the setting to such.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
01-12-14, 08:42 PM   #9
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,504
The statusbar images in the pic come with Discord Unit Frames so the layout may well have used DUF.

Originally Posted by Uriyel View Post
so the abstract bars in this image appear verticle fill and wouldn't need code?
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 01-12-14 at 08:47 PM.
  Reply With Quote
01-12-14, 08:52 PM   #10
Uriyel
A Murloc Raider
Join Date: Jan 2014
Posts: 5
Cool, I'll check them out. I use ElvUI currently. Are there any light versions that might support that image art so I don't have to replace an entire UI or try to make 2 of them play nice together?
  Reply With Quote
01-12-14, 09:19 PM   #11
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 582
Originally Posted by Uriyel View Post
Cool, I'll check them out. I use ElvUI currently. Are there any light versions that might support that image art so I don't have to replace an entire UI or try to make 2 of them play nice together?
You could just replace the status bar texture ElvUI uses.
__________________
Tweets YouTube Website
  Reply With Quote
01-13-14, 01:58 AM   #12
Musca
A Murloc Raider
AddOn Author - Click to view addons
Join Date: Nov 2013
Posts: 8
Originally Posted by Uriyel View Post
Cool, I'll check them out. I use ElvUI currently. Are there any light versions that might support that image art so I don't have to replace an entire UI or try to make 2 of them play nice together?
I'm using Elvui with separate, non-Elv unit frames. Not having any issues between the two -- just disabled Elv's built in unit frames via the in game gui.
  Reply With Quote
01-13-14, 07:04 AM   #13
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,739
What you are looking for can be done very easily nowadays. First you need a texture in the shape that you are looking for. You can shape a texture by adjusting the alpha layer of the TGA file.

Next you write an addon that integrates that graphic. A working health bar is this one:
Lua Code:
  1. local function OnUnitHealthFrequent(bar)
  2.   local hcur, hmax = UnitHealth(bar.unit), UnitHealthMax(bar.unit)
  3.   local hper = 0
  4.   if hmax > 0 then hper = hcur/hmax end
  5.   bar:SetValue(hper)
  6. end
  7.  
  8. local bar = CreateFrame("StatusBar","MyAddonMyHealthBar", UIParent)
  9. bar.unit = "player"
  10. bar:SetSize(100,100)
  11. bar:SetPoint("CENTER",0,0)
  12. bar:SetMinMaxValues(0, 1)
  13. bar:SetStatusBarTexture(PATH_TO_YOUR_SHAPED_TEXTURE)
  14. bar:SetStatusBarColor(1,0,0)
  15. bar:SetOrientation("VERTICAL")
  16. bar:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", bar.unit)
  17. bar:RegisterEvent("PLAYER_LOGIN")
  18. bar:SetScript("OnEvent", OnUnitHealthFrequent)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » UI Screenshots, Feedback and Design Discussion » Custom shapes for health bars

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off