1. #1
    Deleted

    a little aid to a LUA Script N00B default Nameplates

    Dear fellow wow players.
    I decided to turn to this forum in hope of som aid.

    I am a old school default UI user but there is some things with the standard nameplates I wish to be able to adjust
    And would like your guide to make a small LUA script to make it happen.

    The things I would like to have in the code is ways to
    Adjust size (scale) on the nameplates
    Make my current target nameplate scale up
    Set the size of the name font on the nameplate
    Set the size of the debuffs on nameplates.
    I also wonder if you change the anchor point for the debuff closer to the nameplate?

    Thanks for your time
    /Emyara

  2. #2
    Deleted
    Ok
    This is What i have at the moment

    Sizeing of target nameplate Works flawless but i cant change font size and My script is not working.


    Code:
    -- Nameplate targeting size
     
    local Frame = CreateFrame("Frame")
    Frame:RegisterEvent("PLAYER_LOGIN")
     
    Frame:SetScript("OnEvent", function(...)
    SetCVar("nameplateMaxDistance", 45)
    SetCVar("nameplateSelectedScale", 1.2)
    end)
     
    --Set nameplate fontsize
     
    local f = CreateFrame("Frame")
    f:RegisterEvent("PLAYER_LOGIN")
    f:SetScript("OnEvent", function()  
     
    local function SetFont(obj, optSize)
       local fontName= obj:GetFont() 
       obj:SetFont(fontName,optSize,"OUTLINE")
    end
     
    SetFont(SystemFont_LargeNamePlate,10)
    SetFont(SystemFont_NamePlate,10)
    SetFont(SystemFont_LargeNamePlateFixed,10)
    SetFont(SystemFont_NamePlateFixed,10)
     
    end)

  3. #3
    Deleted
    This is some of the code i use in my own scripted default ui so it should work / be useful as a more advanced starting point. The only part i am unsure of is the ScaleNameplateNames part. I used my script to hide the names on enemy nameplates completly as a reference though it might not work with scaling the names.
    also keep in mind this code snippet is completly untested by myself so there might be some typos etc. that prevent it from working.

    Code:
    local EventWatcher = CreateFrame("Frame")
    local NameplateUpdater = CreateFrame("Frame")
    
    local timer = 0
    
    local function SetNameplates()
    	-- Set some CVars
    	SetCVar("nameplateMaxDistance", 45)
    	SetCVar("nameplateSelectedScale", 1.2)
    	SetCVar("nameplateMinScale", 0.8) 	-- minimum scale of all nameplates; default value = 0.8
    	
    	-- Move Debuffs
    	local function MoveDebuffs(self)
    		if self.BuffFrame then
    			self.name.SetFont(STANDARD_TEXT_FONT, 12)
    			self.name.SetShadowOffset(1, -1)
    			self.BuffFrame:SetPoint("BOTTOM", self.name, "TOP", 0, 0)
    			-- If ComboPoints are shown above Enemy Nameplates:
    			--self.BuffFrame:SetPoint("BOTTOM", self.name, "TOP", 0, -10)	-- Debuffs between Combo Points and HealthBar
    			--self.BuffFrame:SetPoint("BOTTOM", self.name, "TOP", 0, 20)	-- Debuffs directly above ComboPoints
    		end
    	end
    	hooksecurefunc("CompactUnitFrame_OnLoad", MoveDebuffs)
    	
    	-- Scale Debuffs
    	local function ScaleNameplateDebuffs(...)
    		for _, v in pairs(C_NamePlate.GetNameplates()) do
    			local bf = v.UnitFrame.BuffFrame
    			bf:SetScale(1)	-- Your desired debuff scale
    		end
    	end
    	NamePlateDriverFrame:HookScript("OnEvent", ScaleNameplateDebuffs)	
    end
    
    -- Scale Names
    function ScaleNameplateNames()
    	for i, frame in ipairs(C_NamePlate.GetNamePlates()) do		
    		local Uf = frame.UnitFrame		
    		Uf.name:SetScale(1)	-- Your desired font size		
    		timer = 0
    	end
    end
    
    NamePlateUpdater:SetScript("OnUpdate", function(self, elapsed)
    	timer = timer + elapsed
    	if timer >= 0.01 then
    		timer = 0
    		ScaleNamePlateNames()
    	end
    end
    
    
    -- Load the stuff
    local function  LoginEvent(self, event, ...)
    	EventWatcher:UnregisterEvent("PLAYER_LOGIN")
    	SetNameplates()	-- Needs to be loaded before first nameplate is loaded
    end
    
    EventWatcher:SetScript("OnEvent", LoginEvent)
    EventWatcher:RegisterEvent("PLAYER_LOGIN")

  4. #4
    Deleted
    Some stuff i put together from my own scripted default ui. there might be some typos and it's untested. also the name scale part might not work as i derived it from a script that hides names on enemy nameplates completely but it should atleast give you a starting point.

    Code:
    local EventWatcher = CreateFrame("Frame")
    local NameplateUpdater = CreateFrame("Frame")
    
    local timer = 0
    
    local function SetNameplates()
    	-- Set some CVars
    	SetCVar("nameplateMaxDistance", 45)
    	SetCVar("nameplateSelectedScale", 1.2)
    	SetCVar("nameplateMinScale", 0.8) 	-- minimum scale of all nameplates; default value = 0.8
    	
    	-- Move Debuffs
    	local function MoveDebuffs(self)
    		if self.BuffFrame then
    			self.name.SetFont(STANDARD_TEXT_FONT, 12)
    			self.name.SetShadowOffset(1, -1)
    			self.BuffFrame:SetPoint("BOTTOM", self.name, "TOP", 0, 0)
    			-- If ComboPoints are shown above Enemy Nameplates:
    			--self.BuffFrame:SetPoint("BOTTOM", self.name, "TOP", 0, -10)	-- Debuffs between Combo Points and HealthBar
    			--self.BuffFrame:SetPoint("BOTTOM", self.name, "TOP", 0, 20)	-- Debuffs directly above ComboPoints
    		end
    	end
    	hooksecurefunc("CompactUnitFrame_OnLoad", MoveDebuffs)
    	
    	-- Scale Debuffs
    	local function ScaleNameplateDebuffs(...)
    		for _, v in pairs(C_NamePlate.GetNameplates()) do
    			local bf = v.UnitFrame.BuffFrame
    			bf:SetScale(1)	-- Your desired debuff scale
    		end
    	end
    	NamePlateDriverFrame:HookScript("OnEvent", ScaleNameplateDebuffs)	
    end
    
    -- Scale Names
    function ScaleNameplateNames()
    	for i, frame in ipairs(C_NamePlate.GetNamePlates()) do		
    		local Uf = frame.UnitFrame		
    		Uf.name:SetScale(1)	-- Your desired font size		
    		timer = 0
    	end
    end
    
    NamePlateUpdater:SetScript("OnUpdate", function(self, elapsed)
    	timer = timer + elapsed
    	if timer >= 0.01 then
    		timer = 0
    		ScaleNamePlateNames()
    	end
    end
    
    
    -- Load the stuff
    local function  LoginEvent(self, event, ...)
    	EventWatcher:UnregisterEvent("PLAYER_LOGIN")
    	SetNameplates()	-- Needs to be loaded before first nameplate is loaded
    end
    
    EventWatcher:SetScript("OnEvent", LoginEvent)
    EventWatcher:RegisterEvent("PLAYER_LOGIN")

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •