Quantcast My CombatIndicator spawns "behind" the frame. - WoWInterface
Thread Tools Display Modes
05-11-18, 02:04 AM   #1
dzreams
A Defias Bandit
Join Date: Jan 2018
Posts: 2
My CombatIndicator spawns "behind" the frame.

Hello, first of all this project is really quite wonderful, but I'm running into a little issue where my CombatIndicator seems to spawn behind the actual frame:



If you look closely, the indicator is "infront" of the background, but "behind" the health bar - when I remove the statusbar elements this is still the case, so somehow I am drawing my statusbars in front of the indicator. I've tried a few things:
  • Hiding the statusbar backgrounds
  • Giving the statusbar and statusbar.bg different "layers"
  • Different order of things
But haven't got to a nice solution. Anyway, here are the relevant codes:

Code:
  self.Health = createStatusBar(self)
  self.Health:SetPoint("TOPLEFT", self, "TOPLEFT", conf.borderSize, -conf.borderSize)
  self.Health:SetPoint("TOPRIGHT", self, "TOPRIGHT", -conf.borderSize, -conf.borderSize)
  self.Health:SetPoint("BOTTOMLEFT", self, "TOPLEFT", 0, -healthHeight)
  self.Health:SetPoint("BOTTOMRIGHT", self, "TOPRIGHT", 0, -healthHeight)
  self.Health.colorSmooth = true
  self.Health.colorClass = true
  self.Health.bg.multiplier = conf.bgMultiplier
Code:
  if unit == "player" then
    self.CombatIndicator = self:CreateTexture(nil, "OVERLAY")
    self.CombatIndicator:SetPoint("CENTER", self, "TOP", 0, 0)
    self.CombatIndicator:SetSize(32, 32)
  end
Code:
local tex = [[Interface\AddOns\bdCore\media\smooth]]
ns.utils.createStatusBar = function (parent)
  local b = CreateFrame("StatusBar", nil, parent)
  b:SetStatusBarTexture(tex, "BORDER")
  b.bg = b:CreateTexture(nil, "BACKGROUND")
  b.bg:SetTexture(tex)
  b.bg:SetAllPoints()
  return b
end
Anyway - any help that you can give me, or hints in the right direction, would be most appreciated.

Thanks
  Reply With Quote
05-11-18, 05:51 AM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,668
Try this for the CombatIndicator
Lua Code:
  1. self.Health:CreateTexture
  Reply With Quote
05-11-18, 01:49 PM   #3
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 780
or make a invisible frame, that works too

Lua Code:
  1. local InvisFrame = CreateFrame("Frame", nil, self)
  2. InvisFrame:SetFrameLevel(Health:GetFrameLevel() + 5)
  3. InvisFrame:SetAllPoints()
  4.  
  5. local Combat = InvisFrame:CreateTexture(nil, "OVERLAY")
  6. Combat:Size(20, 20)
  7. Combat:Point("TOP", self, 0, 9)

Last edited by Aftermathhqt : 05-11-18 at 01:57 PM.
  Reply With Quote
05-11-18, 04:10 PM   #4
dzreams
A Defias Bandit
Join Date: Jan 2018
Posts: 2
Both of those suggestions helped immensely. Thankyou very much.
  Reply With Quote
05-11-18, 08:01 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,542
Originally Posted by Aftermathhqt View Post
or make a invisible frame, that works too

Lua Code:
  1. local InvisFrame = CreateFrame("Frame", nil, self)
  2. InvisFrame:SetFrameLevel(Health:GetFrameLevel() + 5)
  3. InvisFrame:SetAllPoints()
  4.  
  5. local Combat = InvisFrame:CreateTexture(nil, "OVERLAY")
  6. Combat:Size(20, 20)
  7. Combat:Point("TOP", self, 0, 9)
But then you end up with an extra, irrelevant frame. Instead, just use :SetDrawLayer() on the texture to make it draw higher than the healthbar.
__________________
"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

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » My CombatIndicator spawns "behind" the frame.

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