WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   MoP Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=162)
-   -   Nameplates Addon editing for MOP, help needed (https://www.wowinterface.com/forums/showthread.php?t=43921)

mich125 08-19-12 03:32 AM

Nameplates Addon editing for MOP, help needed
 
Hey,

I am now using Nameplates Modifier FanUpdate:

http://www.wowinterface.com/download...FanUpdate.html

Problem is that it doesn't work at all in MOP. I don't know much about coding, if I knew what is wrong exactly, then maybe i could change it myself, but there is no LUA errors, so i have no idea how to fix this addon, if anyone can give me some guidance, on how to fix this addon for MOP i would be rly greatful.

Or maybe someone knows how to create a simple Nameplates addon for MOP, from the scratch, I need 2 functions:

-Default Nameplates with Smooth Texture
-Health Percentages display in the middle of nameplate.

Just like that:


mich125 08-20-12 02:02 AM

So far i got this code, and nameplates smooth texture works now, any idea what to add to display hp %?

Code:

local numChildren = -1;
local handledNameplates = {};
local TEXTURE_PATH = "Interface\\AddOns\\Nameplates\\images\\smooth"; --Set the new statusbar texture path

local function SkinPlate(frame)
        local healthBar, castBar = frame:GetChildren();
        healthBar:SetStatusBarTexture(TEXTURE_PATH);
        castBar:SetStatusBarTexture(TEXTURE_PATH);

        handledNameplates[frame:GetName()] = true;
end

local function HookFrames(...)
        for index = 1, select('#', ...) do
                local frame = select(index, ...);
               
                if(not handledNameplates[frame:GetName()] and (frame:GetName() and frame:GetName():find("NamePlate%d"))) then
                        SkinPlate(frame);
                end
        end
end

CreateFrame('Frame'):SetScript('OnUpdate', function(self, elapsed)
        if(WorldFrame:GetNumChildren() ~= numChildren) then
                numChildren = WorldFrame:GetNumChildren();
                HookFrames(WorldFrame:GetChildren());
        end       
end)


Phanx 08-20-12 06:31 AM

Assuming "frame" refers to a nameplate:

Code:

local healthBar, castBar = frame:GetChildren()
local glowRegion, overlayRegion, highlightRegion, nameTextRegion, levelTextRegion, bossIconRegion, raidIconRegion, stateIconRegion = frame:GetRegions()
local _, castbarOverlay, shieldedRegion, spellIconRegion = castBar:GetRegions()

See any of the *Nameplates addons for more examples; the above was copied from caelNameplates.

mich125 08-20-12 06:43 AM

Hey,

Thanks for reply, ive tried pasting your code, but it doesnt work, it might sound noobish, but could you tell me where exactly should i paste it, maybe im doing it wrong

thanks very much

Phanx 08-20-12 06:48 AM

In your code, you'd put something similar inside the "SkinPlates" function. In fact, you're already using the first line I posted in your own code. Those lines simply get references to the various parts of the nameplate, and then you would need to write more code to actually modify them (eg. by moving them, changing the font, etc.).

Alternatively, you could just use a nameplate addon that's actually still maintained, or a more customizable nameplate addon that lets you change textures and fonts in-game.

mich125 08-20-12 06:53 AM

So this should be done like this?, couse ive just tested it, but it still doesnt display hp% ;(

Code:

local numChildren = -1;
local handledNameplates = {};
local TEXTURE_PATH = "Interface\\AddOns\\Nameplates\\images\\smooth"; --Set the new statusbar texture path

local function SkinPlate(frame)
        local healthBar, castBar = frame:GetChildren()
        local glowRegion, overlayRegion, highlightRegion, nameTextRegion, levelTextRegion, bossIconRegion, raidIconRegion, stateIconRegion = frame:GetRegions()
        local _, castbarOverlay, shieldedRegion, spellIconRegion = castBar:GetRegions()
        healthBar:SetStatusBarTexture(TEXTURE_PATH);
        castBar:SetStatusBarTexture(TEXTURE_PATH);

        handledNameplates[frame:GetName()] = true;
end

local function HookFrames(...)
        for index = 1, select('#', ...) do
                local frame = select(index, ...);
               
                if(not handledNameplates[frame:GetName()] and (frame:GetName() and frame:GetName():find("NamePlate%d"))) then
                        SkinPlate(frame);
                end
        end
end


CreateFrame('Frame'):SetScript('OnUpdate', function(self, elapsed)
        if(WorldFrame:GetNumChildren() ~= numChildren) then
                numChildren = WorldFrame:GetNumChildren();
                HookFrames(WorldFrame:GetChildren());
        end       
end)


Phanx 08-20-12 03:42 PM

Quote:

Originally Posted by mich125 (Post 259994)
So this should be done like this?, couse ive just tested it, but it still doesnt display hp% ;(

Nameplates don't include health text by default. You have to create a font string and update it each time the health changes. Look at the code in the addon I linked in my last post; you should be able to mostly just copy and paste. Look for sections of code that mention "health".


All times are GMT -6. The time now is 11:02 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI