Thread Tools Display Modes
07-01-14, 11:27 AM   #1
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Getting NamePlate frame

I would like to know which nameplate frame is assiged to my current target/focus/player frame, how could i get this info, i was tring to lookup some different addon, but i only run into libs.
  Reply With Quote
07-02-14, 04:42 AM   #2
suicidalkatt
A Rage Talon Dragon Guard
 
suicidalkatt's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 331
Originally Posted by Resike View Post
I would like to know which nameplate frame is assiged to my current target/focus/player frame, how could i get this info, i was tring to lookup some different addon, but i only run into libs.
Sadly the only way to associate those frames is to have a UnitID to match your nameplate frame to.

There are certain nameplate frame items that become 'active' when certain events happen. For example the nameplate highlight becomes visible on mouseover and you can check for your moused over unit id.

You can also see that all other nameplate frames 'fade out' when a unit is targeted.

The way nameplate frames can be found is probably best investigated in this comment:
http://www.wowinterface.com/forums/s...48&postcount=5

Nameplates don't have a UnitGUID available to the base frame. You can use the triggers above to 'assign' a UnitGUID you can compare to and allow for further modifications.

Last edited by suicidalkatt : 07-02-14 at 04:46 AM.
  Reply With Quote
07-02-14, 10:37 AM   #3
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Keeping track of what GUID belongs to which nameplate is complicated enough that I would suggest using a lib for it unless you want to take the time to fully understand the methods used to assign them.

There are only 2 accurate methods for assigning a GUID to a nameplate. The target nameplate stays opaque while the rest have their alpha lowered (there's a delay after switching targets before this is accurate), and mousing over a nameplate frame (not the unit) causes one of its children to become visible.

Once a nameplate goes off the screen or out of range you lose the GUID and have to figure it out again the next time it shows up.

Last edited by semlar : 07-02-14 at 10:39 AM.
  Reply With Quote
07-02-14, 11:03 AM   #4
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by semlar View Post
Keeping track of what GUID belongs to which nameplate is complicated enough that I would suggest using a lib for it unless you want to take the time to fully understand the methods used to assign them.

There are only 2 accurate methods for assigning a GUID to a nameplate. The target nameplate stays opaque while the rest have their alpha lowered (there's a delay after switching targets before this is accurate), and mousing over a nameplate frame (not the unit) causes one of its children to become visible.

Once a nameplate goes off the screen or out of range you lose the GUID and have to figure it out again the next time it shows up.
I guess there is no any easier way to anchor something to the top of the players?
  Reply With Quote
07-02-14, 11:12 AM   #5
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
There is literally no other way to anchor something to a player aside from their nameplate.

If you're only concerned about player units then you do not have to determine the plate's GUID, their names are unique and you can match those instead.
  Reply With Quote
07-02-14, 12:01 PM   #6
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by semlar View Post
There is literally no other way to anchor something to a player aside from their nameplate.

If you're only concerned about player units then you do not have to determine the plate's GUID, their names are unique and you can match those instead.
I came up with this, not sure how good it is:

Lua Code:
  1. local Nameplates = { }
  2.  
  3. function GetTargetPlateNow()
  4.     for _, plate in pairs({WorldFrame:GetChildren()}) do
  5.         if plate:IsVisible() then
  6.             local name = plate:GetName()
  7.             if name and strmatch(name, '^NamePlate%d+$') then
  8.                 Nameplates[name] = { }
  9.                 Nameplates[name].alpha = plate:GetAlpha()
  10.             end
  11.         end
  12.     end
  13.     local x = 0
  14.     local target
  15.     for k, v in pairs(Nameplates) do
  16.         --print(k, v.alpha)
  17.         if v.alpha == 1 then
  18.             target = k
  19.             x = x + 1
  20.         end
  21.     end
  22.     if x == 1 then
  23.         print(target)
  24.         return target
  25.     end
  26. end

Last edited by Resike : 07-02-14 at 12:07 PM.
  Reply With Quote
07-02-14, 01:13 PM   #7
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
I'm currently just experiencing with it, however check this little showcase video where i can put a fake questgiver into the "3D world" with Power Auras:

https://www.youtube.com/watch?v=Wihl64Q4EmM

I see a lot of potential in this usage.

Last edited by Resike : 07-02-14 at 01:18 PM.
  Reply With Quote
07-02-14, 03:50 PM   #8
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Uhoh. This has the potential to restore some of the things that those AR addon was doing a few years ago. Can't remember the name. AVR?
  Reply With Quote
07-02-14, 04:30 PM   #9
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by Duugu View Post
Uhoh. This has the potential to restore some of the things that those AR addon was doing a few years ago. Can't remember the name. AVR?
It's actually still just a simple model/texture just anchored to something which moves with the world, makes you think it's in the 3D world. But the possibilities are limitless, i wonder if you could make an addon which allows to mark enemy players for you.

Last edited by Resike : 07-02-14 at 04:34 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Getting NamePlate frame


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