Thread Tools Display Modes
04-08-10, 07:46 AM   #1
nin
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 213
healthbar help/question

hey ppl's

ive been playing around with a layout with opacity.. and what i want to achieve is too have the healthbar transparent but the background a solid color for better visual's when ppl loose health etc..

im very limited when it comes to coding and have never seen anyone do anything similar so i honestly have no clue how to code this in ouf or exactly what too look after.. i know it's possible in pitbull so it should be doable in ouf?

here's what my layout looks like..

http://img710.imageshack.us/img710/9...batandbags.jpg

Any hints or suggestions are appreciated !
  Reply With Quote
04-08-10, 07:49 AM   #2
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
You want a solid black background with a slightly transparent healthbar on top?

Code:
    local bg = self.Health:CreateTexture(nil, "BACKGROUND")
    bg:SetTexture(0,0,0,1)  --rgba
    bg:ClearAllPoints()
    bg:SetAllPoints(self.Health)
    self.Health.bg = bg
You may see the problem.

self.Health.bg is anchored to self.Health so if you add an alpha value to self.Health it gets applied to self.Health.bg aswell because its a "child" of self.Health

Solution
Code:
    local bg = self:CreateTexture(nil, "BACKGROUND")
    bg:SetTexture(0,0,0,1)  --rgba
    bg:ClearAllPoints()
    bg:SetAllPoints(self.Health)
    self.Health.bg = bg
The texture is now anchored to the self element and not to self.Health thus independent.

Best of luck.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

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

Last edited by zork : 04-08-10 at 07:54 AM.
  Reply With Quote
04-08-10, 08:09 AM   #3
nin
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 213
my explanation skillz sucks!

what i want is too keep the opacity on the health bar (toplayer) but get the background more solid. what happens too me now when changing the background too a more solid color is that the opacity of the whole bar dissapears..

so i want too keep the healthbar transparent but the background solid when loosing health, that makes sense?

here's a edited screenie that i think explains it better..

thanks for the quick reply! ;>

http://img28.imageshack.us/i/dwdwdwdwdwdwdwcopy.jpg/

Last edited by nin : 04-08-10 at 08:11 AM.
  Reply With Quote
04-08-10, 08:19 AM   #4
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Ah ok. This can only be done with a trick. The red bar from your loosing health must be your actual health bar, just with inverted value and from right to left.

The transparent stuff will be your background. So basically your healthbar fills from right to left when loosing health.

This requires that you create your own PostUpdateHealthFunc. Not possible with standard oUF imo.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
04-08-10, 08:26 AM   #5
nin
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 213
ah okay.. i figured it would be tricky.. :P

thanks a lot for the info though!
  Reply With Quote
04-08-10, 08:59 AM   #6
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
You kinda have to use your own statusbar implementation if you want to do reverse statusbar filling with transparency.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
04-08-10, 09:04 AM   #7
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
WoW progromming states that the default statusbar object does not support right-to-left filling. So this can only be done by creating statusbars that aren't statusbars.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
04-08-10, 09:12 AM   #8
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
I've done this (kinda) in my layout "oUF Kritt".
I make them fill instead of deplete and go from right to left, simply by using a texture and math.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » healthbar help/question


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