View Single Post
11-14-15, 07:25 AM   #7
Soulcleaver
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 65
Originally Posted by Phanx View Post
If your goal is just "make this thing the same color as that other thing, always" then you shouldn't be rewriting tons of code -- just grab the color from "that other thing" and apply it to "this thing":

Lua Code:
  1. hooksecurefunc(ThatOtherThing, "SetStatusBarColor", function(self, ...)
  2.      ThisThing:SetVertexColor(...)
  3. end)

You should be able to put that in your OnLoad script, as long as "that other thing" already exists when your panel loads.

Also, the above code assumes that "that other thing" is actually a StatusBar object. If it's just a texture, you'd need to hook SetVertexColor instead of SetStatusBarColor.
Im confused .. xD The bigger bar in the screenshots are my healthbar from stuf unitframes. I just want that little bar the same color as the hp bar u see above it.. so if i target a mage it shows the mage class color, if i target a neutral target it should show the neutral mob color (the one i use on stuf), same goes for the hostile mob.. sorry if im hard to understand.. i tried understanding what you wrote, but as im new to scripts i ended up confused.. xD
  Reply With Quote