Thread Tools Display Modes
02-29-16, 03:22 AM   #1
sdsadasdsa
A Defias Bandit
Join Date: Feb 2015
Posts: 3
need help on lua code~~

Now I can realize these functions through the following lua code(provide by @Phanx,thanks to him)

1.hide and replace player name to "newplayername"
2.hide and replace pet name to "newpetname"
3.hide and replace target of target name
4.hide and replace target of focus name
5.replace friend and enemy player name to their classic name

the following lua code:
Code:
 local CUSTOM_PLAYER_TEXT = "newplayername"
 local CUSTOM_PET_TEXT = "newpetname"
 
local function SetCustomName(unit, fontString)
 if UnitIsUnit(unit, "player") then
 fontString:SetText(CUSTOM_PLAYER_TEXT)
 elseif UnitIsPlayer(unit) then
 fontString:SetText(strupper(UnitClass(unit)))
 else
 fontString:SetText(CUSTOM_PET_TEXT)
 end
 end
 
hooksecurefunc("UnitFrame_Update", function(frame, isParty)
 if frame.name then
 SetCustomName(frame.overrideName or frame.unit, frame.name)
 end
 end)
 
hooksecurefunc("CompactUnitFrame_UpdateName", function(frame)
 SetCustomName(frame.unit, frame.name)
 end)

but can i ask two questions more,how can i :

1.how to hide and replace my name on scoreboard in arean/BG/RBG?also replace friend and enemy player name to their classic name

2.how to hide and replace my name on addon"recount/skada"?also replace friend and enemy player name to their classic name

tyyyyyyyyyyyyyyyyyyvm!

Last edited by sdsadasdsa : 02-29-16 at 03:30 AM.
  Reply With Quote
02-29-16, 09:20 AM   #2
Yukyuk
A Chromatic Dragonspawn
 
Yukyuk's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2015
Posts: 179
Originally Posted by sdsadasdsa View Post
(provide by @Phanx,thanks to him
Phanx is a Her
__________________
Better to fail then never have tried at all.

Last edited by Yukyuk : 03-01-16 at 01:53 PM.
  Reply With Quote
03-01-16, 10:28 AM   #3
sdsadasdsa
A Defias Bandit
Join Date: Feb 2015
Posts: 3
need help ~~~~~~~~

Now I can realize these functions through the following lua code(provide by @Phanx,thanks to him)

1.hide and replace player name to "newplayername"
2.hide and replace pet name to "newpetname"
3.hide and replace target of target name
4.hide and replace target of focus name
5.replace friend and enemy player name to their classic name

the following lua code:
Code:
 local CUSTOM_PLAYER_TEXT = "newplayername"
 local CUSTOM_PET_TEXT = "newpetname"
 
local function SetCustomName(unit, fontString)
 if UnitIsUnit(unit, "player") then
 fontString:SetText(CUSTOM_PLAYER_TEXT)
 elseif UnitIsPlayer(unit) then
 fontString:SetText(strupper(UnitClass(unit)))
 else
 fontString:SetText(CUSTOM_PET_TEXT)
 end
 end
 
hooksecurefunc("UnitFrame_Update", function(frame, isParty)
 if frame.name then
 SetCustomName(frame.overrideName or frame.unit, frame.name)
 end
 end)
 
hooksecurefunc("CompactUnitFrame_UpdateName", function(frame)
 SetCustomName(frame.unit, frame.name)
 end)

but can i ask two questions more,how can i :

1.how to hide and replace my name on scoreboard in arean/BG/RBG?also replace friend and enemy player name to their classic name

2.how to hide and replace my name on addon"recount/skada"?also replace friend and enemy player name to their classic name

tyyyyyyyyyyyyyyyyyyvm!
  Reply With Quote
03-01-16, 12:00 PM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Didn't you already ask this yesterday?
https://www.wowinterface.com/forums/showthread.php?t=53160
__________________
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)
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » need help on lua code~~

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