View Single Post
11-14-15, 01:46 PM   #12
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
If all you want is for your panel colour to change to the same as the healthbar colour whenever it changes then Phanx's method is the way to go.

It assumes the healthbar is a StatusBar widget and you know the name of it, which you should be able to get with /fstack, and that STUF is loaded before your panels OnLoad fires.

IF the name of the healthbar is say STUF_TargetHealth then in your panels OnLoad (delete the RegisterEvent and all the OnEvent code you have) and add:

Code:
    hooksecurefunc(STUF_TargetHealth, "SetStatusBarColor", function(self, ...)
         self.bg:SetVertexColor(...)
    end)
Every time the healthbar changes it will also change your panel colour.

You might need something additional depending on what you want to do when the target goes out-of-range.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 11-14-15 at 01:57 PM.
  Reply With Quote