WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Classic - AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=180)
-   -   Change font colour of the HP-text from Blizzard-Raid Frames (https://www.wowinterface.com/forums/showthread.php?t=57758)

rulezyx 01-02-20 09:33 PM

Change font colour of the HP-text from Blizzard-Raid Frames
 
For WoW Classic,

Is it possible to change the 'greyish' color of the 'lost health' text from the default raid frames to something more visible like red? I changed the font but I wonder if and how you can change the color too.

Seerah 01-03-20 01:50 PM

How did you change the font?

rulezyx 01-04-20 09:10 PM

https://pastebin.com/ZGPvVgzW

I ripped that from an older file. Its working but not perfectly. I hope someone can rewirte/correct it. Some side Informations are above the hook in the link.

Since the default font is faded out and grey the color change could help healers alot. Also it makes the classic raidframes and the losthealth-text function more interesting to use.

Vrul 01-05-20 11:17 AM

Not tested but you can try:
Code:

hooksecurefunc("CompactUnitFrame_UpdateStatusText", function(self)
        local statusText = self.statusText
        if statusText and statusText:IsShown() then
                if self.optionTable.healthText == "losthealth" and tonumber(statusText:GetText() or "") then
                        if not statusText.fontOverridden then
                                statusText.fontOverridden = true
                                statusText:SetFont("Fonts\\ARIALN.TTF", 16)
                                statusText:SetTextColor(0.95, 0.2, 0.2)
                        end
                elseif statusText.fontOverridden then
                        statusText.fontOverridden = nil
                        statusText:SetFont("Fonts\\FRIZQT__.TTF", 12)
                        statusText:SetTextColor(0.5, 0.5, 0.5)
                end
        end
end)


rulezyx 01-05-20 11:37 AM

Thank you! I will test it and tell you :)

rulezyx 01-05-20 12:03 PM

It works but sometimes the losthealth-text appeares to be smaller (fontsize) on certain players, maybe because out of range. Is there a way to change that?

- Ok I changed the font size from 12 to 16 now its working fine.

Is it possible to create an outline / shadow for the font so it gets more visible?

Vrul 01-05-20 12:43 PM

For an outline change:
Code:

statusText:SetFont("Fonts\\ARIALN.TTF", 16)
to
Code:

statusText:SetFont("Fonts\\ARIALN.TTF", 16, "OUTLINE")
For shadow just add these lines after the SetFont and SetTextColor calls:
Code:

statusText:SetShadowColor(0, 0, 0, 0.5)
statusText:SetShadowOffset(1, -1)

I'd only use an outline or shadow but not both so pick the one you think looks best.

rulezyx 01-05-20 01:07 PM

Thank you that helped alot! Yes the outline is way too much but with the shadow only theres literally no difference. Is it possible to dark the shadow a bit? I use flat textures for the raidframes thats why I need a difference to these colors.

Vrul 01-05-20 01:12 PM

The last number for SetShadowColor is the alpha (transparency) and can be a value for 0 (invisible) to 1 (solid):
Code:

statusText:SetShadowColor(0, 0, 0, 1)

Seerah 01-05-20 01:13 PM

Code:

statusText:SetShadowColor(0, 0, 0, 0.5) --red, green, blue, alpha

rulezyx 01-05-20 01:28 PM

That really helped me alot. Thank you both for the fast answers.:)

rulezyx 01-05-20 03:27 PM

2 Attachment(s)
Sorry for asking again but I tested it in battlegrounds and sometimes the health-text shows up in a different size. Is there a way to fix that? It should always be in the same size because everything else is pretty confusing.
Also the red color is a bit blurry. Is it possible to make it more mat/intense? :confused:
https://pastebin.com/x8zgAd6N
1. Picture ;Top right is pretty 'big' everything else is pretty small (guess should be default) and sometimes its the other way.
2. Picture ;Red looks a bit too orange/blurry.

rulezyx 01-05-20 04:01 PM

1 Attachment(s)
I tried to find out why the text-size is changing. For some reason its working sometimes. The text is rly big or rly small or mixed. Maybe I miss something.

jeruku 01-05-20 05:04 PM

The inner if statement stops it from defaulting back or instead of an elseif use an else.

Lua Code:
  1. if self.optionTable.healthText == "losthealth" and tonumber(statusText:GetText() or "") and not statusText.fontOverridden then
  2.       --blah
  3. end

rulezyx 01-05-20 05:19 PM

Ok I get that but if I change elseif to else its not working at all.

jeruku 01-05-20 05:29 PM

Sorry about that. Else is used when falling back and since it wouldn't be overridden setting the flag makes no difference so it should look something like this.

Lua Code:
  1. hooksecurefunc("CompactUnitFrame_UpdateStatusText", function(self)
  2.     local statusText = self.statusText
  3.     if statusText and statusText:IsShown() then
  4.         if self.optionTable.healthText == "losthealth" and tonumber(statusText:GetText() or "") and not statusText.fontOverridden then
  5.             statusText.fontOverridden = true
  6.             statusText:SetFont("Fonts\\ARIALN.TTF", 16)
  7.             statusText:SetTextColor(0.95, 0.2, 0.2)
  8.             statusText:SetShadowColor(0, 0, 0, 1)
  9.             statusText:SetShadowOffset(1, -1)
  10.         else
  11.             statusText.fontOverridden = nil
  12.             statusText:SetFont("Fonts\\ARIALN.TTF", 16)
  13.             statusText:SetTextColor(0.5, 0.5, 0.5)
  14.             statusText:SetShadowColor(0, 0, 0, 1)
  15.             statusText:SetShadowOffset(1, -1)
  16.         end
  17.     end
  18. end)

rulezyx 01-05-20 05:38 PM

I tried that but the text color is on default (grey) again. It somehow doesnt lock the red color. If I change around at the frame/text-hp settings it triggers the red color on some frames but not all, a few are still grey or getting grey again.

Vrul 01-05-20 07:12 PM

Give this a try:
Code:

hooksecurefunc("DefaultCompactUnitFrameSetup", function(self)
        local statusText = self.statusText
        statusText:SetFont("Fonts\\ARIALN.TTF", 16)
        statusText:SetShadowColor(0, 0, 0, 1)
        statusText:SetShadowOffset(1, -1)
end)

hooksecurefunc("CompactUnitFrame_UpdateStatusText", function(self)
        local statusText = self.statusText
        if statusText and statusText:IsShown() then
                if self.optionTable.healthText == "losthealth" and tonumber(statusText:GetText() or "") then
                        if not statusText.colorOverridden then
                                statusText.colorOverridden = true
                                statusText:SetTextColor(0.95, 0.1, 0.1, 1)
                        end
                elseif statusText.colorOverridden then
                        statusText.colorOverridden = nil
                        statusText:SetTextColor(0.5, 0.5, 0.5, 1)
                end
        end
end)


rulezyx 01-05-20 08:19 PM

2 Attachment(s)
Thanks alot Vrul. You did pretty much everything. :)Atm it works great. With smaller RaidFrames (like 40 ppl) the text is rly big (like in the first image). Is it possible to get this on default size (like in the second image).

Vrul 01-05-20 10:21 PM

Try changing the line:
Code:

statusText:SetFont("Fonts\\ARIALN.TTF", 16)
to:
Code:

statusText:SetFont("Fonts\\ARIALN.TTF", 16 * (statusText:GetHeight() or 12) / 12)

rulezyx 01-05-20 11:12 PM

Ok I tried that but unfortunately nothing changed/happend.

I could just change the fontsize from 16 to 14 or something but when I switch to other profiles like for 5 or 10/20 man groups (Bigger Frames) the fontsize is still the same and doesnt match the size of the Frames at all (too small). Thats why I am asking.

Vrul 01-06-20 07:03 AM

Try changing the line (before the last change):
Code:

statusText:SetFont("Fonts\\ARIALN.TTF", 16)
to:
Code:

statusText:SetFont("Fonts\\ARIALN.TTF", 16 * min(DefaultCompactUnitFrameSetupOptions.height / 36, DefaultCompactUnitFrameSetupOptions.width / 72))

rulezyx 01-06-20 12:52 PM

I tried that but the size is still the same as before :(

Vrul 01-06-20 05:42 PM

Give this a shot:
Code:

hooksecurefunc("DefaultCompactUnitFrameSetup", function(self)
        local fontSize = 16 * min(DefaultCompactUnitFrameSetupOptions.height / 36, DefaultCompactUnitFrameSetupOptions.width / 72)
        local statusText = self.statusText
        statusText:SetFont("Fonts\\ARIALN.TTF", fontSize)
        statusText:SetHeight(fontSize)
        statusText:SetShadowColor(0, 0, 0, 1)
        statusText:SetShadowOffset(1, -1)
end)

hooksecurefunc("CompactUnitFrame_UpdateStatusText", function(self)
        local statusText = self.statusText
        if statusText and statusText:IsShown() then
                if self.optionTable.healthText == "losthealth" and tonumber(statusText:GetText() or "") then
                        if not statusText.colorOverridden then
                                statusText.colorOverridden = true
                                statusText:SetTextColor(0.95, 0.1, 0.1, 1)
                        end
                elseif statusText.colorOverridden then
                        statusText.colorOverridden = nil
                        statusText:SetTextColor(0.5, 0.5, 0.5, 1)
                end
        end
end)


rulezyx 01-06-20 07:12 PM

I guess it did everything because the font-size is pretty much the same related/matched to all the frame profiles. I think I will go with 12 instead of 16 because its pretty big but I think thats it :)

Where do I put outline if I want to change that?

Vrul 01-06-20 07:32 PM

Same as before:
Code:

statusText:SetFont("Fonts\\ARIALN.TTF", fontSize, "OUTLINE")

rulezyx 01-06-20 08:37 PM

is it possible to make the outline smaller / thinner like with the shadow?

Vrul 01-06-20 08:42 PM

No. The only other option is "THICKOUTLINE" in place of "OUTLINE" which makes is thicker.

rulezyx 01-06-20 09:06 PM

Ok, ty so much :)

rulezyx 01-14-20 09:00 AM

change position
 
I was trying to display the text a bit lower because in default its directly in the middle of the frame. I use other mods to display buffs / heals on the other half and with bigger frames those are overlapping with lost-health text.

I tried: statusText:SetPoint("CENTER", 0, -10)

but that doesnt seem to work at all. :(

It seems the text is always locked to the middle of the frame. Any suggestions?:confused:

Seerah 01-14-20 01:16 PM

You need to clear it's original position first.

(:ClearAllPoints())

rulezyx 01-15-20 01:09 AM

Code:

hooksecurefunc("DefaultCompactUnitFrameSetup", function(self)
        local fontSize = 12 * min(DefaultCompactUnitFrameSetupOptions.height / 36, DefaultCompactUnitFrameSetupOptions.width / 72)
        local statusText = self.statusText
        statusText:SetFont("Fonts\\ARIALN.TTF", fontSize)
        statusText:SetHeight(fontSize)
        statusText:SetShadowColor(0, 0, 0, 1)
        statusText:SetShadowOffset(1, -1)
        :ClearAllPoints()
        statusText:SetPoint("CENTER", 0, -10)
end)

hooksecurefunc("CompactUnitFrame_UpdateStatusText", function(self)
        local statusText = self.statusText
        if statusText and statusText:IsShown() then
                if self.optionTable.healthText == "losthealth" and tonumber(statusText:GetText() or "") then
                        if not statusText.colorOverridden then
                                statusText.colorOverridden = true
                                statusText:SetTextColor(0.95, 0.1, 0.1, 1)
                        end
                elseif statusText.colorOverridden then
                        statusText.colorOverridden = nil
                        statusText:SetTextColor(0.5, 0.5, 0.5, 1)
                end
        end
end)

Ok I tried that but it doesnt matter if I put it to compact or default its still in the same position.

Maybe I missed something.

rulezyx 01-16-20 02:29 AM

I think the clear statement works but I dont know about setpoint. The text seems to be stuck there in the middle.:(

Vrul 01-16-20 04:37 AM

Code:

:ClearAllPoints()
should be
Code:

statusText:ClearAllPoints()

rulezyx 01-16-20 05:52 AM

Ok thats working :o Ty

rulezyx 01-18-20 05:17 AM

Is it possible to put the text in the foreground? Sometimes with bigger numbers its behind an aura/buff. is there a way to fix that?

Vrul 01-18-20 09:53 AM

Add
Code:

statusText:SetDrawLayer("OVERLAY", 7)
after your ClearAllPoints/SetPoint calls
Code:

hooksecurefunc("DefaultCompactUnitFrameSetup", function(self)
        local fontSize = 12 * min(DefaultCompactUnitFrameSetupOptions.height / 36, DefaultCompactUnitFrameSetupOptions.width / 72)
        local statusText = self.statusText
        statusText:SetFont("Fonts\\ARIALN.TTF", fontSize)
        statusText:SetHeight(fontSize)
        statusText:SetShadowColor(0, 0, 0, 1)
        statusText:SetShadowOffset(1, -1)
        statusText:ClearAllPoints()
        statusText:SetPoint("CENTER", 0, -10)
        statusText:SetDrawLayer("OVERLAY", 7)
end)

hooksecurefunc("CompactUnitFrame_UpdateStatusText", function(self)
        local statusText = self.statusText
        if statusText and statusText:IsShown() then
                if self.optionTable.healthText == "losthealth" and tonumber(statusText:GetText() or "") then
                        if not statusText.colorOverridden then
                                statusText.colorOverridden = true
                                statusText:SetTextColor(0.95, 0.1, 0.1, 1)
                        end
                elseif statusText.colorOverridden then
                        statusText.colorOverridden = nil
                        statusText:SetTextColor(0.5, 0.5, 0.5, 1)
                end
        end
end)


rulezyx 01-18-20 01:36 PM

Ok I tried that but the text is still behind the buffs/auras/debuffs. No issues but nothing is changing.

Also it happens that the text-position is different for some player frames (resettet, from what I changed it to in the first place)
And the outline is missing too (which I added). But I think thats related to the sort per role/name/group option.

Code:

hooksecurefunc("DefaultCompactUnitFrameSetup", function(self)
        local fontSize = 12 * min(DefaultCompactUnitFrameSetupOptions.height / 36, DefaultCompactUnitFrameSetupOptions.width / 72)
        local statusText = self.statusText
        statusText:SetFont("Fonts\\ARIALN.TTF", fontSize, "OUTLINE")
        statusText:SetHeight(fontSize)
        statusText:SetShadowColor(0, 0, 0, 1)
        statusText:SetShadowOffset(1, -1)
        statusText:ClearAllPoints()
        statusText:SetPoint("CENTER", 0, -6)
        statusText:SetDrawLayer("OVERLAY", 7)
end)

hooksecurefunc("CompactUnitFrame_UpdateStatusText", function(self)
        local statusText = self.statusText
        if statusText and statusText:IsShown() then
                if self.optionTable.healthText == "losthealth" and tonumber(statusText:GetText() or "") then
                        if not statusText.colorOverridden then
                                statusText.colorOverridden = true
                                statusText:SetTextColor(0.95, 0.1, 0.1, 1)
                        end
                elseif statusText.colorOverridden then
                        statusText.colorOverridden = nil
                        statusText:SetTextColor(0.5, 0.5, 0.5, 1)
                end
        end
end)


rulezyx 01-20-20 02:32 PM

Ok, so I tried to hide the auras/buffs instead. It seems that the layer isnt changeable like that. The numbers/text is always behind the buffs/auras.:confused::(


All times are GMT -6. The time now is 03:05 AM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2021 MMOUI