Thread Tools Display Modes
03-24-16, 01:51 PM   #1
Ansi
An Aku'mai Servant
 
Ansi's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 33
Question Portrait damage addon - need help coloring the font

Hi
I wrote an addon to display damage on the target frame, with a lot of help from this forum, a long time ago. It's very simple.

Now I'd like to know if it's possible to color the font based on what hit e.g. ─ can you make white hits and yellow hits, just like the normal damage font ─ and is it possible to color crits orange for example?

Code:
local txt=TargetFrameTextureFrame:CreateFontString("TargetHitIndicator","OVERLAY","NumberFontNormalHuge");
txt:SetPoint("CENTER",TargetFrameTextureFrame,"TOPRIGHT",-73,-42);
txt:Hide();
CombatFeedback_Initialize(TargetFrame,txt,30);
 
TargetFrame:RegisterUnitEvent("UNIT_COMBAT","target");
TargetFrame:HookScript("OnEvent",function(self,event,unit,...)
    if event=="UNIT_COMBAT" then CombatFeedback_OnCombatEvent(self,...); end
end);
 
TargetFrame:HookScript("OnUpdate",CombatFeedback_OnUpdate);
Thank you in advance for any help, it's all much appreciated! :-)
__________________
twitter.com/ansirox
  Reply With Quote
03-24-16, 07:52 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
The default UI should already switch between white and yellow to differentiate between physical and spell hits. Critical hits increase the size by 50%.

If you really want to apply a crit color and override the white/yellow you could do this.
Lua Code:
  1. hooksecurefunc("CombatFeedback_OnCombatEvent",function(self,event,flags,amount)
  2.     if event=="WOUND" and amount~=0 and (flags=="CRITICAL" or flags=="CRUSHING") then
  3.         self.feedbackText:SetTextColor(1,0.5,0);
  4.     end
  5. );
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
03-26-16, 02:06 PM   #3
Ansi
An Aku'mai Servant
 
Ansi's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 33
Originally Posted by SDPhantom View Post
The default UI should already switch between white and yellow to differentiate between physical and spell hits. Critical hits increase the size by 50%.

If you really want to apply a crit color and override the white/yellow you could do this.
Lua Code:
  1. hooksecurefunc("CombatFeedback_OnCombatEvent",function(self,event,flags,amount)
  2.     if event=="WOUND" and amount~=0 and (flags=="CRITICAL" or flags=="CRUSHING") then
  3.         self.feedbackText:SetTextColor(1,0.5,0);
  4.     end
  5. );
Thanks a lot!
__________________
twitter.com/ansirox
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Portrait damage addon - need help coloring the font


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