r/wowaddons • • 7d ago

Development / WIP ADDON Idea - Is it possible to replace your character's overhead name with a floating health bar?

Hey everyone!

I've been working on what I thought would be a simple small addon for WoW Forever and I'm trying to figure out if it's possible to replace the text above your own character's head with a proper health bar, similar to the nameplate you see above an enemy or target.

The goal is to have it appear only during combat, follow your character in the 3D world, and scale/adjust naturally when zooming the camera in and out.

I've been working through this with the help of ChatGPT and have managed to get the first part working which is hiding my character's name when entering combat and restoring it afterward.

Where I'm stuck is getting an actual health bar to occupy that same position.

I've asked chatgpt and it looked into the nameplate API, C_NamePlate, NAME_PLATE_UNIT_ADDED, and the Personal Resource Display, but haven't found a way to access or create a proper player nameplate. I also tried an addon called My Personal Bars Forever, but it uses screen-space positioning rather than actually anchoring to the character.

Is this something the WoW Forever client/API simply doesn't allow, or is there another method that I am overlooking?

Would love to hear from anyone familiar with the nameplate API, UI frames, or addon development in Forever. Even a little direction would be appreciated!

11 Upvotes

41 comments sorted by

•

u/AutoModerator 7d ago

Development / Work In Progress Notice:

This addon is currently in an unfinished state.

Moderation does not audit Development/WIP posts for strict code quality standards. Please do not report this post for unoptimized code or messy namespaces unless it violates core safety or TOS rules.

Constructive feedback to help the developer improve is highly encouraged!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

12

u/BeneficialAd8793 7d ago

hey, i've looked into this myself, though only briefly. as i understand it, while at one point they had this built in, they removed it from the game for some reason (i think it was allowing people to do some sort of exploit). if you find a way to have a personal resource bar exist in the 3D space, keep us posted!

and for the inevitable response saying to turn on Personal Resource in options, no. the existing personal resource bar does not exist in the 3D space, hence why it remains static when you zoom in and out.

3

u/Galllo89 7d ago

Finally a real comment. Thank you! <3

1

u/Positive-Pension-166 3d ago

Isn't this easily solvable with weakauras? The hiding of your name should be a setting somewhere.

Just make an hp/resource bar with weakauras

7

u/Louieyaa 7d ago

I thought i was going crazy that it was in the game before lol

1

u/Double_Dragonfruit6 4d ago

It was first added in Legion iirc

8

u/OhWhoopsIDroppedMy 7d ago

this is the closest i could find [addon] Remember the moveable Personal Nameplate added in Legion and removed with the addon purge? I'm rebuilding it. : r/WowUI

Blizzard locked down the WOW Lua api hard which makes drawing stuff in 3d space near impossible

2

u/Heybarbaruiva 7d ago

Yeah, that's it. Gotta do it manually now. It works, though.

1

u/Galllo89 7d ago

Would this theoretically work for WOW Forever?

2

u/Heybarbaruiva 7d ago

Yeah I use it on Forever just fine.

2

u/Galllo89 7d ago edited 7d ago

Sweet Thanks! Is there anywhere I can find the addon or is it possible to get a zip for me to run it through my stuff? Im just trying to make a simplified version of it :)

1

u/BeneficialAd8793 7d ago

where can i find a link to this?

1

u/Galllo89 7d ago

Thank you!

1

u/w3djyt 7d ago

This was amazing when it was out. I built an entire UI around it T_T

1

u/OhWhoopsIDroppedMy 7d ago
local PIVOT      = 2.0    -- yards above your feet the camera orbits 
local TAG_HEIGHT = 2.6    -- yards above your feet to put the bar (just over the head)
local PITCH      = math.rad(20)  -- assumed camera pitch (looking down)

local bar = CreateFrame("StatusBar", nil, UIParent)
bar:SetSize(80, 8)
bar:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar")
bar:SetStatusBarColor(0, 1, 0)
local bg = bar:CreateTexture(nil, "BACKGROUND")
bg:SetAllPoints()
bg:SetColorTexture(0, 0, 0, 0.6)

-- Focal length in UIParent units estimated from the FOV setting
local function Focal()
    local fov = tonumber(GetCVar("cameraFov")) or 90
    local vfov = math.rad(fov * 0.6)            -- rough vertical FOV
    return 0.5 / math.tan(vfov / 2) * UIParent:GetHeight()
end

bar:SetScript("OnUpdate", function(self)
    local zoom = GetCameraZoom()
    if not zoom or zoom < 1.5 then self:SetAlpha(0) return end   -- first person: hide

    local pivot = IsMounted() and PIVOT + 1 or PIVOT
    local dh    = TAG_HEIGHT + (IsMounted() and 1 or 0) - pivot   -- bar height above the pivot
    local depth = zoom - dh * math.sin(PITCH)
    if depth < 0.5 then self:SetAlpha(0) return end

    local y = dh * math.cos(PITCH) / depth * Focal()
    self:ClearAllPoints()
    self:SetPoint("CENTER", UIParent, "CENTER", 0, y)
    self:SetScale(math.min(1.5, math.max(0.5, 15 / zoom)))   -- shrink as the camera pulls back

    self:SetMinMaxValues(0, UnitHealthMax("player"))
    self:SetValue(UnitHealth("player"))
    self:SetAlpha(1)
end)

The camera looks straight at a pivot point on your character, so your character always sits in the horizontal centre of the screen. A point dh yards above that pivot appears this far above the screen centre:

y = dh * cos(pitch) / (zoom - dh * sin(pitch)) * focal

The addon API only gives you zoom (GetCameraZoom()). Pitch isn't exposed, so the snippet uses a fixed 20°. At normal zoom the bar drifts only a few pixels as the real pitch changes.

  • PIVOT and TAG_HEIGHT are guesses and will need tuning per race.
  • I'm not sure whether GetCameraZoom() reports the camera after a wall pushes it in, so the bar may sit off indoors.
  • I haven't tested this in-game yet

3

u/Ok-Department-6452 7d ago

Disable nameplate enable personal resource display with power bar disabled, just swap them in out combat should cover it, I can draft some code when I get home

1

u/Galllo89 7d ago

Thats ok! I already have that implemented, the main thing was getting the power bar to adapt with your camera bascially.

1

u/mi_zzi 7d ago

Claude, make ma an addon... just disable 'My Name' under Options -> Gameplay (Nameplates) -> My Name and enable Personal Resource Display in Options -> Gameplay (Combat) -> Personal Resource Display. Customize it how yo like in Edit Mode

1

u/Galllo89 7d ago

That was the easy part and if you watch the video thats already been done simply with chatgpt. The question pertains to healthbars anchoring to where your nameplate is that way it scales as your camera zooms in our out + you will be able to enable stacking etc so you can see yours and the targets clearly.

2

u/dasgoooose 7d ago

I just made this exact addon for someone else. I'll message you the link.

1

u/ElectronicPrint7607 3d ago

Could you post it to me as well?

1

u/Zackete 7d ago

Not exactly what you're looking for, but I do something similar with forever auras although the display is plain numbers. I use it to display my health and rage for warrior and is attached to the enemy nameplate so technically on a more or less fixed position.

1

u/LoadIntelligent7564 7d ago

Archud does it better for me

1

u/ObligationAncient112 6d ago

All friendly nameplates are protected in combat so you can't anchor anything to them, your only option to have any kind of dynamic positioning is using camera positioning but I'm also not sure this can be done with the secret restrictions.

Having the healthbar only be shown in combat is easy, I'm not 100% sure you can hide your own name in combat but I think so.

I just use the Personal Bar but with static positioning

1

u/kossenin 7d ago

Isn’t that just personal ressource ?

0

u/BsyFcsin 7d ago

That’s what I thought

-1

u/Mysterious-Watch777 7d ago

I dunno bro, my health is over there. There's also a personal resource setting you can toggle.

2

u/Galllo89 7d ago

Yes that is what I am using in the video I posted. Been just trying to elevate it to the next level that is all.

1

u/Mysterious-Watch777 7d ago

what level xD

1

u/Galllo89 7d ago

Having the Personal Resource bar anchor to your nameplate so when your in combat it appears and when its gone your nameplate comes back

-5

u/Ohrder 7d ago

Ask Claude instead of Reddit, you won't need to wait for an answer.

7

u/Gyc3 7d ago

what are we even doing here anymore

-3

u/EquivalentRace458 7d ago

Why is this downvoted? Everything can be self-served these days.

-1

u/Difficult-Ad-3938 7d ago

So why are you commenting this?

1

u/mistermeowowowow 7d ago

Someone has to spread the RTFM gospel.

2

u/Difficult-Ad-3938 7d ago

The point is the OP posts for the same reason comments are there - because he wants to ask people and see answers, not to get to the point. We can stop using reddit altogether since claude can replace 90% of posts and comments here

0

u/Heart_Resonance 7d ago

NO, don't do that

0

u/Quizok 3d ago

If you have your regular how bar under your char, what do you need another one so close. It's too much of the same info in close proximity. Also why would you have your name above, your own name is pointless. Just remove it and keep it clear so you can see better.

-5

u/toastjarom 7d ago

Just press Shift-V or Ctrl-V