Addon \ macro creation help

Volsci

Legend
I've recently been getting more "serious" about arena on ATR.

For the next bit of future, I am looking to get more comfortable when recognizing combat v out of combat (for saps). I'm somewhat comfortable with it and can manage mid-game saps relatively consistently, but I'd like to take it a step further.


What I'm looking to do is configure a miniature addon for use in arena that would display an icon next to a playerframe when somebody is in combat, and no icon when they aren't, so I can get more comfortable with situations where someone may be out of combat. Or maybe even a simple script, I'm not sure.


After I did a little research, I wound up with the following:


local f = CreateFrame("Frame", UIParent)
f.t = f:CreateTexture()
f.t:SetTexture("Interface\\CHARACTERFRAME\\UI-StateIcon.blp")
f.t:SetTexCoord(0.5,1,0,0.49);
f.t:SetAllPoints(f)
f:SetWidth(20)
f:SetHeight(20)
f:SetPoint("CENTER", TargetFrame, "CENTER", 15, 20)
f:Show()


local function FrameOnUpdate(self)
if UnitAffectingCombat("target") then
self:Show()
else
self:Hide()
end
end
local g = CreateFrame("Frame")
g:SetScript("OnUpdate", function(self) FrameOnUpdate(f) end)

Thoughts on this? What (if anything) needs fixing?
And, most importantly, are there any secrets I should know about for implementing it to my UI? or is it as simple as dropping it into my addon folder in a text document labeled .lua


Thanks!
Genocist
 
Last edited by a moderator:
local f = CreateFrame("Frame",nil,UIParent)
f.t = f:CreateTexture(nil,"ARTWORK")
f.t:SetTexture("Interface\\CHARACTERFRAME\\UI-StateIcon.blp")
f.t:SetTexCoord(0.5,1,0,0.49);
f.t:SetAllPoints(f)
f:SetWidth(20)
f:SetHeight(20)
f:SetPoint("CENTER", TargetFrame, "CENTER", 15, 20)
f:Show()

local function FrameOnUpdate(self)
if UnitAffectingCombat("target") then
self:Show()
else
self:Hide()
end
end
f:SetScript("OnUpdate",FrameOnUpdate);

Fixed a few minor things. You could also replace UIParent with TargetFrame if you wanted to (edit: in fact you probably should if it's staying on the target frame), and ARTWORK with OVERLAY if it doesn't show above other textures.

Easiest way to get it to work is just copy-pasting it into the lua file of another addon you have enabled, otherwise you'll need to create a new addon folder containing both a toc and lua file.
 
Thanks for your input!

I'll test it in a few hours once I get home from classes and post how it went.
 
Unfortunately, nothing at all seems to be happening.

I've just opened the Cooldowns lua of DoomCooldownPulse since it is my only addon always enabled, alas, nada =/
 
it is 25 pages long, and not related to the addon im using.
 
Oh right, I see why the original script was using a seperate update frame.

Either replace the last line with this:
local g = CreateFrame("Frame",nil,TargetFrame);
g:SetScript("OnUpdate",function() FrameOnUpdate(f) end);

or change self:Show() and self:Hide() to self.t:Show() and self.t:Hide()
 
Also: The current change is still doing nothing.

Edit :
actually, when i first log in, a small icon of crossed swords display at the bottom right of my playerframe. Whenever i target anyone, they permanently go away until i log out & in.
 
Yes, I altered the last line. That is what made the change to add the swords for the first login.
 
Working fine for me
Code:
local f = CreateFrame("Frame",nil,TargetFrame)
f.t = f:CreateTexture(nil,"OVERLAY")
f.t:SetTexture("Interface\\CHARACTERFRAME\\UI-StateIcon.blp")
f.t:SetTexCoord(0.5,1,0,0.49);
f.t:SetAllPoints(f)
f:SetWidth(20)
f:SetHeight(20)
f:SetPoint("CENTER", TargetFrame, "CENTER", 15, 20)
f:Show()

local function FrameOnUpdate(self)
if UnitAffectingCombat("target") then
self.t:Show()
else
self.t:Hide()
end
end
f:SetScript("OnUpdate",FrameOnUpdate);
 
This is 3.3.5 not 5.1.?, that could be part of my issue.

Nevertheless! The folks at AT have an addon custom configured for it, so the probem is solved. s

Thanks a bunch for your time, Aelobin
 
This isnt ment to be a cocky answear BUT.

You do not need a Addon for such a incredebly easy thing as knowing if someone is out of combat. It's about learning your class. The best way to do this if your serious about arena, or about pvp and your class which now is rogue? Just play, learn this in the usual way. If you learn it by a addon you will have a hard time learning play without it, and in the end you will have a harder time then actually learing it yourself by feeling.

Tips (Ps I dont know how new you are so will just tell you all that i know)

Telling your partner to always los your sap target so he cant get in combat in the start of a arena.
ALWAYS know where your enemy is, If a healer is drinking you gotta be fast to sprint Stealth/Vanish/Shadowdance>Sap withut having to look around

When you should attemt to sap!
Sap after blind and cc that cant be dispellable
gouge someone behind a pillar in nagrand/Dalaran and downstairs blades edge, will make him get out of combat before he gets around after.
When you interuppt a target he always gets out of combat (most ppl dont know this and wont be ready for it) tho if they spam instants after you have about 0.2sec to sap.

And all these things you will be alot better off learning the hard way then to see on a addon + one less thing to keep an eye on is more awareness to everything else.

<3
 
Nonono, I'm not new at all. It's more for the metagame of saps .. I can sap off LOS shivs, kicks, whatnot, no problem. Kidney saps before it was cool.

I'm really just looking at something to moniter the behavior of people out of combat .. IE - when learning to deadzone warriors, I ran a script that turned the ground red for where I needed to be standing to not get melee'd or charged. Played with it for a week, now it is no problem to do.




As a conclusion thing, the addon is called Combat Indicator. It was perfect; I configured it so that the playerframe "face" would be a combat icon when in combat, and the face when not. I was good with saps before (They're kind of my niche ^^ ) but things are simply so much more fluid now, and I don't have nearly so many "oops" vanishes \ dances for saps.
 

Users who are viewing this thread

Top