I have the script below I use on login to replace enemy names with Arena 1,2, & 3 above nameplate(s).
/run local U=UnitIsUnit hooksecurefunc(“CompactUnitFrame_UpdateName”,funct ion(F)if IsActiveBattlefieldArena()and F.unit:find(“nameplate”)then for i=1,5 do if U(F.unit,“arena”…i)then F.name:SetText(i)F.name:SetTextColor(1,1,0)break end end end end)
I want to turn this into an addon so I don’t have to run every time I reload. Can anyone help?
1 Like
Inside your AddOns folder make a folder with the desired addon name. Let’s say you call your addon ArenaNumbers.
Make
- an ArenaNumbers.toc file
- an ArenaNumbers.lua file
- an ArenaNumbers.xml file
all inside the ArenaNumbers folder.
In the ArenaNumbers.toc file, you want
## Interface: 80300
## Title: ArenaNumbers
## Notes: Blah
ArenaNumbers.xml
ArenaNumbers.lua
In the .xml file, go to
wowwiki.fandom.com/wiki/UI_XML_tutorial
and copy paste the bit just above “Validation with XSD” into the file.
In the .lua file,
local U=UnitIsUnit
hooksecurefunc(“CompactUnitFrame_UpdateName”, function(F)
if IsActiveBattlefieldArena() and F.unit:find(“nameplate”) then
for i=1,5 do
if U(F.unit,“arena”…i) then
F.name:SetText(i)
F.name:SetTextColor(1,1,0)
break
end end end end)
Also because of the wonkiness of character translation, I would retype the lua file yourself rather than copy paste. When I copy paste from the forums into a raw text file I get some weird characters appearing which will give you lua errors.
Edit: Also, in the “arena”…i, bit in the lua file, you should have two . rather than an ellipsis. Two dots is concatenation, three dots in lua stands for a variable number of arguments.
This isn’t working for me. I get lui error
google wow best pvp scripts and download the addon best pvp scripts.
1 Like
Is there a way that I can move the number to the left of the nameplate?
no idea if op will read this
but incase anyone else finds themselves in a similar situation
https://addon.bool.no/
put your script here
it’ll create a file you put into your addon folder that will then become an addon in your addon control panel that will auto run your script when you log in
1 Like