Thread Tools Display Modes
05-24-14, 04:38 PM   #1
Ash93
A Deviate Faerie Dragon
Join Date: May 2014
Posts: 12
Script/Addon for Combat Text

Was wondering if anyone knew how to make damage text show up on the target portrait like the player portrait. Also I was wondering if it is possible to make the damage and healing floating combat text rounded to something like 50,000 -> 50k. I know Mik's can do that but I couldn't get it to do it over the enemy player's head.

Thanks
  Reply With Quote
05-24-14, 11:04 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Ash93 View Post
Also I was wondering if it is possible to make the damage and healing floating combat text rounded to something like 50,000 -> 50k. I know Mik's can do that but I couldn't get it to do it over the enemy player's head.
This is not possible, as the default UI's floating damage/healing text is rendered as part of the game world, not as part of the UI, and addons don't have access to it. If they did, they could use it that access to get information Blizzard doesn't want addons to have, such as calculating the exact position of enemy units based on the position of the text. If you want to change any aspect of the floating damage/healing text other than which font it uses, you have to use an addon to replace the whole system, and you can't have the numbers appear over the relevant units in the game world.

Originally Posted by Ash93 View Post
Was wondering if anyone knew how to make damage text show up on the target portrait like the player portrait.
Not tested, but this should work:
Code:
local text = TargetFrame:CreateFontString(nil, "OVERLAY", "NumberFontNormalHuge")
text:SetPoint("CENTER", TargetFrame, "TOPLEFT", 73, -42)
text:Hide()

CombatFeedback_Initialize(self, text, 30)

local f = CreateFrame("Frame", nil, TargetFrame)
f:RegisterUnitEvent("UNIT_COMBAT", "target")
f:SetScript("OnEvent", function(self, event, unit, ...)
     CombatFeedback_OnCombatEvent(TargetFrame, ...)
end)
f:SetScript("OnUpdate", function(self, elapsed)
     CombatFeedback_OnUpdate(TargetFrame, elapsed)
end)
If you need help turning the above code into an addon, copy and paste it into this page:
http://addon.bool.no/
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
05-24-14, 11:30 PM   #3
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
I feel like I saw this somewhere...

http://us.battle.net/wow/en/forum/topic/12945884634

Oh
__________________
Tweets YouTube Website
  Reply With Quote
05-24-14, 11:57 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by 10leej View Post
I feel like I saw this somewhere...
http://us.battle.net/wow/en/forum/topic/12945884634
How is that thread related to this one in any way?
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
05-25-14, 06:56 AM   #5
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Originally Posted by Phanx View Post
How is that thread related to this one in any way?
You know what I have no idea... I was running on vicadin and some other drug though cause of a recent foot surgery so I was thinking of something.
__________________
Tweets YouTube Website
  Reply With Quote
05-25-14, 11:27 AM   #6
Ash93
A Deviate Faerie Dragon
Join Date: May 2014
Posts: 12
Originally Posted by Phanx View Post
This is not possible, as the default UI's floating damage/healing text is rendered as part of the game world, not as part of the UI, and addons don't have access to it. If they did, they could use it that access to get information Blizzard doesn't want addons to have, such as calculating the exact position of enemy units based on the position of the text. If you want to change any aspect of the floating damage/healing text other than which font it uses, you have to use an addon to replace the whole system, and you can't have the numbers appear over the relevant units in the game world.



Not tested, but this should work:
Code:
local text = TargetFrame:CreateFontString(nil, "OVERLAY", "NumberFontNormalHuge")
text:SetPoint("CENTER", TargetFrame, "TOPLEFT", 73, -42)
text:Hide()

CombatFeedback_Initialize(self, text, 30)

local f = CreateFrame("Frame", nil, TargetFrame)
f:RegisterUnitEvent("UNIT_COMBAT", "target")
f:SetScript("OnEvent", function(self, event, unit, ...)
     CombatFeedback_OnCombatEvent(TargetFrame, ...)
end)
f:SetScript("OnUpdate", function(self, elapsed)
     CombatFeedback_OnUpdate(TargetFrame, elapsed)
end)
If you need help turning the above code into an addon, copy and paste it into this page:
http://addon.bool.no/
The script didn't work. It breaks my other scripts.
  Reply With Quote
05-25-14, 03:09 PM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
First rule of bug reporting -- just saying "it doesn't work" is worse than useless. Describe the actual problem, with specific details, and the exact text of the error message (if any) from BugSack.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
05-25-14, 06:27 PM   #8
Ash93
A Deviate Faerie Dragon
Join Date: May 2014
Posts: 12
Originally Posted by Phanx View Post
First rule of bug reporting -- just saying "it doesn't work" is worse than useless. Describe the actual problem, with specific details, and the exact text of the error message (if any) from BugSack.
Code:
Message: Interface\FrameXML\CombatFeedback.lua:33: attempt to index local 'self' (a nil value)
Time: 05/25/14 20:22:00
Count: 1
Stack: Interface\FrameXML\CombatFeedback.lua:33: in function `CombatFeedback_Initialize'
Interface\AddOns\YourAddon\YourAddon.lua:32: in main chunk

Locals: self = nil
feedbackText = <unnamed> {
 0 = <userdata>
}
fontHeight = 30
(*temporary) = "attempt to index local 'self' (a nil value)"


It gave me this.
  Reply With Quote
05-26-14, 10:40 AM   #9
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
Try changing
Code:
CombatFeedback_Initialize(self, text, 30)
to
Code:
CombatFeedback_Initialize(TargetFrame, text, 30)
If this causes taint issues you could just try this instead:
Code:
local text = TargetFrame:CreateFontString(nil, "OVERLAY", "NumberFontNormalHuge")
text:SetPoint("CENTER", TargetFrame, "TOPLEFT", 73, -42)
text:Hide()

local f = CreateFrame("Frame", nil, TargetFrame)
f:RegisterUnitEvent("UNIT_COMBAT", "target")

CombatFeedback_Initialize(f, text, 30)

f:SetScript("OnEvent", function(self, event, unit, ...)
     CombatFeedback_OnCombatEvent(self, ...)
end)
f:SetScript("OnUpdate", function(self, elapsed)
     CombatFeedback_OnUpdate(self, elapsed)
end)

Last edited by Rainrider : 05-26-14 at 10:46 AM.
  Reply With Quote
01-24-23, 08:01 AM   #10
bestpanda
A Kobold Labourer
Join Date: Jan 2023
Posts: 1
Works like charm, this is what I need

I knew it was an old topic, but till now we still don't have a simple addon to realise this in 2023. This just simply solve my problem without using any additional complex UI addon but add what I need based on Blizzard default target portrait.

Thanks!
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Script/Addon for Combat Text

Thread Tools
Display Modes

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