CombatStatus Icon

5 views
Skip to first unread message

sidoro...@yandex.ru

unread,
Apr 6, 2011, 7:27:37 PM4/6/11
to Tidy Plates
Hi!
I really like your addon..
I want to suggest new widget:
Depending on the condition of the players (i use mobs for test) (in
combat or not) will change the icon.

http://s57.radikal.ru/i158/1104/88/76483e094d54.jpg
http://s52.radikal.ru/i137/1104/8a/5176aece0ca6.jpg
http://s49.radikal.ru/i123/1104/2f/a53934f60e84.jpg
http://s013.radikal.ru/i325/1104/7b/d3cd9e57a9d1.jpg

I tried to write it myself, but I have a problem with update. All
works good, but i have cycle error with "Message:
Interface\AddOns\TidyPlates\widgets\CombatStateWidget.lua:31: attempt
to index local 'unit' (a number value)".
I cant fix this error by myself, but I suspect that I incorrectly
identifies current target of player . I will be grateful for any help
and doubly grateful if this widget will appear in the next update. Tnx
a lot :)

Some code:

local function UpdateCombatStateWidget(self, unit)
if UnitAffectingCombat("target") and unit.isTarget
then
self.Icon:SetTexture("Interface\\CharacterFrame\\UI-StateIcon")
self.Icon:SetTexCoord(0.5, 1.0, 0.0, 0.5)
self:Show();
else
self:Hide();
end
end

local function CombatStateWidget(parent)
local frame = CreateFrame("Frame", nil, parent);
frame:SetScript("OnUpdate", UpdateCombatStateWidget);
frame:SetWidth(24); frame:SetHeight(24);
frame:SetPoint("TOPLEFT", 0, -3);
frame.Icon = frame:CreateTexture(nil, "OVERLAY");
frame.Icon:SetPoint("CENTER",frame);
frame.Icon:SetAllPoints(frame);
frame:Hide();
frame.Update = UpdateCombatStateWidget;
return frame
end

Daniel

unread,
Apr 8, 2011, 6:28:23 AM4/8/11
to Tidy Plates
Actually, the code that you've posted looks fine. I'm not sure which
line is #31 (from your error), but it might be related to how the
widget is inserted into Neon.

Post (or email) your OnInitialize and OnUpdate functions, and we can
take a look..

On Apr 6, 7:27 pm, sidoroviv...@yandex.ru wrote:
> Hi!
> I really like your addon..
> I want to suggest new widget:
> Depending on the condition of the players (i use mobs for test) (in
> combat or not) will change the icon.
>
> http://s57.radikal.ru/i158/1104/88/76483e094d54.jpghttp://s52.radikal.ru/i137/1104/8a/5176aece0ca6.jpghttp://s49.radikal.ru/i123/1104/2f/a53934f60e84.jpghttp://s013.radikal.ru/i325/1104/7b/d3cd9e57a9d1.jpg

sidoro...@yandex.ru

unread,
Apr 8, 2011, 8:27:56 AM4/8/11
to Tidy Plates
Thanks for feedback, i'l mail you!

On Apr 8, 2:28 pm, Daniel <binb...@gmail.com> wrote:
> Actually, the code that you've posted looks fine.  I'm not sure which
> line is #31 (from your error), but it might be related to how the
> widget is inserted into Neon.
>
> Post (or email) your OnInitialize and OnUpdate functions, and we can
> take a look..
>
> On Apr 6, 7:27 pm, sidoroviv...@yandex.ru wrote:
>
>
>
>
>
>
>
> > Hi!
> > I really like your addon..
> > I want to suggest new widget:
> > Depending on the condition of the players (i use mobs for test) (in
> > combat or not) will change the icon.
>
> >http://s57.radikal.ru/i158/1104/88/76483e094d54.jpghttp://s52.radikal...
Reply all
Reply to author
Forward
0 new messages