Help with textures on frames update
Hi
I have a simple script to change texture on frames, but HP and Mana bars texture gets changed to default when hp/mana value changes. I assume that I need some sort of "onupdate" script to keep new textures on? Anyone can help me plz? When i load ui, new textures load fine: When hp changes, red hp texture is default When hp/mana changes, mana texture changes to default: Lua Code:
|
I found something like this, is that what i need?
Lua Code:
|
getmetatable(PlayerFrameHealthBar).__index is the metatable for ALL StatusBar widgets. You are hooking every frame imaginable "Show" call by doing this. You don't want to do that.
Doing hooksecurefunc(PlayerFrameHealthBar, "Show", ...) should be enough or better yet PlayerFrameHealthBar:HookScript("OnShow", ...) but ideally find out when Blizzard run their code, and run your styling after theirs instead of hooking Show related events. :) |
Damn, guess i found simpler solution
I created folder \Interface\TargetingFrame and copied my texture there with name UI-StatusBar ....:banana: |
Keep in mind that solution will not work for anyone else using your addon (if you plan to release it).
The health bar texture wasn't getting changed. The red bar in your screenshot is the additional bars for heals and absorbs. To fix that, you just need to set the textures for those: Code:
frame.myHealPredictionBar:SetTexture(x) The power bar texture does get reset, because some power types now have unique textures (eg. maelstrom for enhancement shamans). Use a hook to reapply your desired texture every time it gets updated: Code:
hooksecurefunc("UnitFrameManaBar_UpdateType", function(manaBar) Code:
frame.myManaCostPredictionBar:SetTexture(x) |
Also a better way to catch all these is probably:
lua Code:
|
Quote:
|
Any idea why your solution doesnt work?
There is no lua errors so i dnno what to do. |
It may not work if the key does not exist for a specific unitframe.
Example for PlayerFrameManaBar https://github.com/tomrus88/Blizzard...Frame.xml#L345 It has no key for manaBar. PlayerFrame.manaBar does not exist. You have to use PlayerFrameManaBar. Phanx posted you a solutions that works for unitframes that have keys referencing specific child objects. |
Sorry. Change "healthBar" and "manaBar" to "healthbar" and "manabar" (lowercase "b") in the UnitFrameRegions table.
Those keys are set for in UnitFrame_Initialize, which all the unit frames call in their OnLoad scripts: https://www.townlong-yak.com/framexm...itFrame.lua#51 The other bars/textures should all work, though. |
@Phanx, thank you for your solution.
I have a same problem, but only when player gets damage. Before damage Then player gets damage Why this happens? Thanks. |
I think I found a solution.
When you set PlayerFrameHealthBar:SetStatusBarTexture(texture) you also need set a same texture to AnimatedLossBar. PlayerFrameHealthBar.AnimatedLossBar:SetStatusBarTexture(texture) |
All times are GMT -6. The time now is 11:55 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI