-
Posted by Dimension on Sun, 14 Dec 2008 06:24:15
Hi,
I am trying to make the TargetText addon from your book. I am now creating the function TargetText:UpdatePowerType() on page 197. But I can't get the ManaBarColor to work.It gives me the error:
Attempt to index global 'ManaBarColor' (a nil value).I also have a little problem with the UnitClass update function. If I select a target, it won't give me a class but it gives me his name again. The color of the class is good.
Can you please help me?
-
Posted by Dimension on Sun, 14 Dec 2008 06:24:15
Hi,
I am trying to make the TargetText addon from your book. I am now creating the function TargetText:UpdatePowerType() on page 197. But I can't get the ManaBarColor to work.It gives me the error:
Attempt to index global 'ManaBarColor' (a nil value).I also have a little problem with the UnitClass update function. If I select a target, it won't give me a class but it gives me his name again. The color of the class is good.
Can you please help me?
-
Posted by Dimension on Sun, 14 Dec 2008 06:30:29
I can't edit this post, so I reply to it.
I only have the UnitClass program on NPC's. So it will give me a class back perfectly for players. But it gives me the name of the unit if it is a NPC. -
Posted by jnwhiteh on Sun, 14 Dec 2008 10:11:41
Every patch to WoW brings potential changes to the UI and 3.0.x is one of them. For one, the references to "Mana" in the interface have been changed to "Power", so the table you are looking for is now called
PowerBarColor
. In addition the wayUnitClass()
works for NPCs has changed, as detailed on that API page (http://wowprogramming.com/docs/api/UnitClass).In short, you should use
PowerBarColor
andUnitClassBase()
instead ofUnitClass()
when dealing with an NPC. -
Posted by Dimension on Sun, 14 Dec 2008 11:32:51
Thank you very much for your fast answer. It works perfect!
I have one more question about the TargetText addon. How does UnitReactionColor work (page 204)? Is that also changed in version 3.0.x ? I keep getting errors from it, and my text stays blue.Thanks :)
-
Posted by jnwhiteh on Sat, 20 Dec 2008 08:54:28
Yes,
UnitReactionColor
has been removed. You can use the following method instead:local r, g, b
local reaction = UnitReaction(unit, "player");
if ( reaction ) then
r = FACTION_BAR_COLORS[reaction].r;
g = FACTION_BAR_COLORS[reaction].g;
b = FACTION_BAR_COLORS[reaction].b;
end -
Posted by Dimension on Sun, 21 Dec 2008 07:05:07
And again, it works perfect!
Thank you very much. -
Posted by Ularave on Tue, 23 Dec 2008 15:53:10
Where do we put this new code? does it go into each of the different reactions?
-
Posted by Ularave on Tue, 23 Dec 2008 16:03:28
sorry about double post but it won't let me edit.
I figured it out, maybe i should try it more before asking.
-
Posted by techweenie on Sun, 28 Dec 2008 01:06:08
The following code works a treat for me in place of the bloated code listed earlier.
color = FACTION_BAR_COLORS[reaction]