Quantcast
Basic example of spawning nameplates? - WoWInterface
Thread Tools Display Modes
09-30-20, 05:52 PM   #1
aelen
A Murloc Raider
Join Date: Sep 2020
Posts: 5
Basic example of spawning nameplates?

Hello! I've been using oUF for a while and until now I've been using plater for unit frames.

In preparation for shadowlands I figured I'd give spawning unit frames with oUF a go as well, however most of the layouts that I look at are quite complex in terms of abstractions. I'm kinda looking for a bare minimum example of spawning a healthbar for a unit, so that I can then apply custom styling.

Anyone know where I can find this, or have some basic code laying around?
  Reply With Quote
09-30-20, 06:10 PM   #2
aelen
A Murloc Raider
Join Date: Sep 2020
Posts: 5
Ok so I got some basic stuff working (health bar + hp) https://gyazo.com/5d91598c698bd152847663eb94bc0b66

But as you can see the scaling is a bit out of whack compared to my regular unit frames (player frame can be seen on the bottom left) - is this due to me setting a custom UIScale?

Code:
local f = CreateFrame("Frame", nil, UIParent)
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function(self, event)
	UIParent:SetScale(768/1440)
	f:UnregisterAllEvents()
end)
Is what I have in another addon since I use a 3440x1440 monitor and I'm trying to achieve pixel-perfection. Do I need to apply the same scale to the nameplates, or is there something else I need to do?

Appreciate any help!
  Reply With Quote
09-30-20, 06:12 PM   #3
aelen
A Murloc Raider
Join Date: Sep 2020
Posts: 5
I'm also getting a bunch of issues trying to style the unit frame, but then the frame does not exist anymore, which I guess is due to the NAME_PLATE_UNIT_REMOVED event - is there a special way to handle this?
  Reply With Quote
10-03-20, 04:44 AM   #4
neverg
A Frostmaul Preserver
 
neverg's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2007
Posts: 265
Hey,

You've got a full example here on my layout: https://github.com/greven/oUF_Lumen/...nameplates.lua

Dunno if it the best way to do it, if there is any alternative but it works fine for my use.
__________________
My oUF Layout: oUF Lumen
  Reply With Quote
10-05-20, 05:51 AM   #5
aelen
A Murloc Raider
Join Date: Sep 2020
Posts: 5
Oh awesome, I'm gonna check that out! Like I said I have a basic example working but the scaling is off + there's some lua errors happening whenever nameplates disappear off screen, so hopefully I can find something in your layout to help with these issues.

I think the scaling is a matter of setting the same scaling on nameplates as I do on the UIParent, but the lua errors I'm not sure about.
  Reply With Quote
10-15-20, 10:36 PM   #6
keivamp
A Kobold Labourer
AddOn Author - Click to view addons
Join Date: Dec 2019
Posts: 1
my super basic oUF Nameplates

These have all the basic functionality and fully customizable yo suit what ever you need. https://github.com/keivamp/oUF_Nameplates
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Basic example of spawning nameplates?

Thread Tools
Display Modes

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