Thread Tools Display Modes
07-30-09, 11:59 PM   #1
camelot10
A Kobold Labourer
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 1
Arena targets - need help

Anyone know ouf layout or maybe documentation or link somewhere where i can read how to add arena enemys frames into my ouf layout?
  Reply With Quote
07-31-09, 01:48 AM   #2
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Code:
local arena = {}
for i = 1, 5 do
	arena[i] = oUF:Spawn("arena"..i, "oUF_Stiletto_Arena"..i)
	if i == 1 then
		arena[i]:SetPoint("CENTER", 400, -100)
	else
		arena[i]:SetPoint("TOP", arena[i-1], "BOTTOM", 0, -10)
	end
end
Might be a cleaner way to do it but I couldn't find headers or anything like that. It works fine, though.
  Reply With Quote
10-03-09, 07:59 PM   #3
deffen
A Murloc Raider
Join Date: Oct 2009
Posts: 4
Originally Posted by Waverian View Post
Code:
local arena = {}
for i = 1, 5 do
	arena[i] = oUF:Spawn("arena"..i, "oUF_Arena"..i)
	if i == 1 then
		arena[i]:SetPoint("CENTER", 400, -100)
	else
		arena[i]:SetPoint("TOP", arena[i-1], "BOTTOM", 0, -10)
	end
end
Might be a cleaner way to do it but I couldn't find headers or anything like that. It works fine, though.
I've been trying this for a few hours now, but I cant get it spawned.

My oUF_Arena looks like this:

Code:
if(self:GetParent():GetName():match"oUF_Arena") then
		self:SetWidth(160)
		self:SetHeight(20)
		self.Health:SetHeight(15)
		self.Power:SetHeight(3)
		self.Power.value:Hide()
		self.Health.value:SetPoint("RIGHT", 0 , 9)
		self.Name:SetPoint("LEFT", 0, 9)
end
Anyone who can help?
  Reply With Quote
10-03-09, 08:55 PM   #4
Waverian
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 188
Originally Posted by deffen View Post
I've been trying this for a few hours now, but I cant get it spawned.

My oUF_Arena looks like this:

Code:
if(self:GetParent():GetName():match"oUF_Arena") then
		self:SetWidth(160)
		self:SetHeight(20)
		self.Health:SetHeight(15)
		self.Power:SetHeight(3)
		self.Power.value:Hide()
		self.Health.value:SetPoint("RIGHT", 0 , 9)
		self.Name:SetPoint("LEFT", 0, 9)
end
Anyone who can help?
I think the problem is your conditional. You'd use :GetParent():GetName() on headers, but the arena frames when spawned this way aren't constructed by a header. The layout function is called 5 times, one for each arena frame, with the 'self' being a reference to the actual frame (self:GetName():match"...").

Alternatively you can use a separate layout function entirely (I used this method since my arena frames varied a lot from my normal frames):

lua Code:
  1. <the rest of your layout>
  2.  
  3. local ArenaStyle = function(self, unit)
  4. -- layout bits
  5. end
  6.  
  7. oUF:RegisterStyle('MyLayoutArena', ArenaStyle)
  8. oUF:SetActiveStyle('MyLayoutArena')
  9.  
  10. -- spawn arena frames
  Reply With Quote
10-04-09, 12:49 AM   #5
deffen
A Murloc Raider
Join Date: Oct 2009
Posts: 4
Originally Posted by Waverian View Post
I think the problem is your conditional. You'd use :GetParent():GetName() on headers, but the arena frames when spawned this way aren't constructed by a header. The layout function is called 5 times, one for each arena frame, with the 'self' being a reference to the actual frame (self:GetName():match"...").

Alternatively you can use a separate layout function entirely (I used this method since my arena frames varied a lot from my normal frames):

lua Code:
  1. <the rest of your layout>
  2.  
  3. local ArenaStyle = function(self, unit)
  4. -- layout bits
  5. end
  6.  
  7. oUF:RegisterStyle('MyLayoutArena', ArenaStyle)
  8. oUF:SetActiveStyle('MyLayoutArena')
  9.  
  10. -- spawn arena frames
Thanks alot, self:GetName():match"..." worked like a charm.
  Reply With Quote
10-25-09, 04:33 AM   #6
davee
A Kobold Labourer
Join Date: Oct 2008
Posts: 1
How do I make it so that when someone in arena stealth, the frame does not disappear?
  Reply With Quote
11-07-09, 07:32 AM   #7
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
I included arena frames to my layout. I also added arena frame targets like this...

Code:
	if(unit and unit:find('arena%dtarget')) then
... style of arena targets ... 
end

I spawn them like this...

Code:
local arenaTarget = {}
for i = 1, 5 do
	arenaTarget[i] = oUF:Spawn('arena'..i..'target', 'oUF_Arena'..i..'Target')
	if i == 1 then
	arenaTarget[i]:SetPoint('TOP', arena[1], 'BOTTOM', 0, -4)
	elseif i == 2 then
	arenaTarget[i]:SetPoint('TOP', arena[2], 'BOTTOM', 0, -4)
	elseif i == 3 then
	arenaTarget[i]:SetPoint('TOP', arena[3], 'BOTTOM', 0, -4)
	elseif i == 4 then
	arenaTarget[i]:SetPoint('TOP', arena[4], 'BOTTOM', 0, -4)
	elseif i == 5 then
	arenaTarget[i]:SetPoint('TOP', arena[5], 'BOTTOM', 0, -4)	
	end
end

For some funny reason, those frames seem to inherit their layout code from "some" (not sure which, maybe target, maybe focus, maybe party ... it looks by default like one of those) other unit frame. Which means I basically do have to override the code to be able to change it (i.e. ClearSetPoints() to move things or Hide() things that shouldn't be there, but are there on another frame). Strange, I've never seen that happen before, for any other frames. Am I addressing them wrong or how/why does this happen?

Last edited by Dawn : 11-07-09 at 07:34 AM.
  Reply With Quote
11-07-09, 01:18 PM   #8
Soeters
A Warpwood Thunder Caller
 
Soeters's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 97
What you could do is create different layout (very different by style just for the test) and see what arena targets looks like in order to know which layout they imitate.


Maybe that will become easier to see what's misplaced, and from which layout it comes, when you have very different layouts
__________________
  Reply With Quote
03-19-10, 01:13 PM   #9
deffen
A Murloc Raider
Join Date: Oct 2009
Posts: 4
I've started to play with this again, but I'm running into the same errors as last time, just now I cant fix them.

The problem is the frames arent showing when I'm entering arena, anyone who have an idear what to do?

My code is looking like this:

Code:
if(self:GetName():match"oUF_Arena") then
	self:SetWidth(160)
	self:SetHeight(20)
	self.Health:SetHeight(15)
	self.Power:SetHeight(3)
	self.Power.value:Hide()
	self.Health.value:SetPoint("RIGHT", 0 , 9)
	self.Name:SetPoint("LEFT", 0, 9)
end

local arena = {}
for i = 1, 5 do
	arena[i] = oUF:Spawn("arena"..i, "oUF_Arena"..i)
	if i == 1 then
		arena[i]:SetPoint("TOPLEFT", arena[i], "TOPRIGHT", 6, 0)
	else
		arena[i]:SetPoint("TOP", arena[i-1], "BOTTOM", 0, -20)
	end
end
Thanks in advance.
  Reply With Quote
03-19-10, 01:33 PM   #10
deffen
A Murloc Raider
Join Date: Oct 2009
Posts: 4
Originally Posted by deffen View Post
I've started to play with this again, but I'm running into the same errors as last time, just now I cant fix them.

The problem is the frames arent showing when I'm entering arena, anyone who have an idear what to do?

My code is looking like this:

Code:
if(self:GetName():match"oUF_Arena") then
    self:SetWidth(160)
    self:SetHeight(20)
    self.Health:SetHeight(15)
    self.Power:SetHeight(3)
    self.Power.value:Hide()
    self.Health.value:SetPoint("RIGHT", 0 , 9)
    self.Name:SetPoint("LEFT", 0, 9)
end

local arena = {}
for i = 1, 5 do
    arena[i] = oUF:Spawn("arena"..i, "oUF_Arena"..i)
    if i == 1 then
        arena[i]:SetPoint("TOPLEFT", arena[i], "TOPRIGHT", 6, 0)
    else
        arena[i]:SetPoint("TOP", arena[i-1], "BOTTOM", 0, -20)
    end
end
Thanks in advance.
Found the problem so nvm
  Reply With Quote
03-20-10, 08:22 AM   #11
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Am I the only one using specific style functions for every unit?
This has the big plus that I can activate specific styles for every unit that I spawn. The style functions itself callc other functions to create stuff, but with adjusted parameters depending on unit.

Creating only one style from top to bottom is pretty crazy imo because you have to use conditions all the time.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
03-20-10, 12:10 PM   #12
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by zork View Post
Am I the only one using specific style functions for every unit?
This has the big plus that I can activate specific styles for every unit that I spawn. The style functions itself callc other functions to create stuff, but with adjusted parameters depending on unit.

Creating only one style from top to bottom is pretty crazy imo because you have to use conditions all the time.
Lily has been doing a shared/separate solution for quite some time now. I'm also promoting the solution as a boilerplate for 1.4 layouts.
__________________
「貴方は1人じゃないよ」
  Reply With Quote
03-29-10, 01:45 PM   #13
nailertn
An Aku'mai Servant
Join Date: Oct 2008
Posts: 33
It's a matter of how one prefers to organize really. I like setting up each element by going generic / unit specific, generic / unit specific. The former method focuses on unit, the latter on element. Both ways work so long as it is done consistently.
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Arena targets - need help


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