View Single Post
11-17-19, 01:47 PM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
Looks like nameplates on classic behave differently than on modern.
Here's a more complete example with the changes.
Lua Code:
  1. --  Nametag font size
  2. local function SetFont(obj,optSize)
  3.     local fontName=obj:GetFont();
  4.     obj:SetFont(fontName,optSize,"THINOUTLINE");
  5. end
  6.  
  7. SetFont(SystemFont_LargeNamePlate,8);
  8. SetFont(SystemFont_NamePlate,8);
  9. SetFont(SystemFont_LargeNamePlateFixed,8);
  10. SetFont(SystemFont_NamePlateFixed,8);
  11.  
  12. --  Disable nametag colors
  13. DefaultCompactNamePlateFriendlyFrameOptions.colorNameBySelection=false;
  14. DefaultCompactNamePlateEnemyFrameOptions.colorNameBySelection=false;
  15. DefaultCompactNamePlatePlayerFrameOptions.colorNameBySelection=false;
  16.  
  17. --  Move nametag
  18. hooksecurefunc(NamePlateDriverFrame,"OnNamePlateCreated",function(_,base)--   Hook nameplate creation function
  19.     local unitframe=base.UnitFrame;--   UnitFrame attached to nameplate base
  20.     unitframe.name:ClearAllPoints();--  Clear nametag anchors
  21.  
  22. --  Set new anchor(s) here
  23.     unitframe.name:SetPoint("BOTTOM",unitframe.healthBar,"TOP",0,4);
  24. end);
  25.  
  26. --  Remove realm names
  27. hooksecurefunc("CompactUnitFrame_UpdateName",function(frame)
  28.     if ShouldShowName(frame) then
  29.         frame.name:SetVertexColor(1,1,1);-- Fixes tapped mobs permanently setting the nametag gray
  30.         frame.name:SetText(GetUnitName(frame.unit));
  31.     end
  32. end);

Note: A recreation of the existing anchor is given to illustrate how to set an anchor from Lua. If you need more detail on the function, see fontstring:SetPoint().
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 11-18-19 at 12:14 PM.
  Reply With Quote