WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   Script/Addon for Combat Text (https://www.wowinterface.com/forums/showthread.php?t=49324)

Ash93 05-24-14 04:38 PM

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

Phanx 05-24-14 11:04 PM

Quote:

Originally Posted by Ash93 (Post 292960)
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.

Quote:

Originally Posted by Ash93 (Post 292960)
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/

10leej 05-24-14 11:30 PM

I feel like I saw this somewhere...

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

Oh

Phanx 05-24-14 11:57 PM

Quote:

Originally Posted by 10leej (Post 292971)
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? :confused:

10leej 05-25-14 06:56 AM

Quote:

Originally Posted by Phanx (Post 292976)
How is that thread related to this one in any way? :confused:

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.

Ash93 05-25-14 11:27 AM

Quote:

Originally Posted by Phanx (Post 292968)
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. :(

Phanx 05-25-14 03:09 PM

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.

Ash93 05-25-14 06:27 PM

Quote:

Originally Posted by Phanx (Post 292992)
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.

Rainrider 05-26-14 10:40 AM

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)


bestpanda 01-24-23 08:01 AM

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!


All times are GMT -6. The time now is 04:41 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI