Quantcast
WoWInterface - View Single Post - Flashy name for nearby guild mates
View Single Post
05-02-21, 11:55 AM   #14
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,638
okay .. with the following code ( some bug fixes to spelling mistakes ) it worked. I turned nameplates always on and walked in and out of range of my other character in the guild and the sound played. It may get annoying if several guildies arrive at the same time or you are running back and forth. So you may want to consider some sort of timing system so that it only alerts you for a person once every x seconds/minutes etc.

Lua Code:
  1. local guildie={}
  2. local f=CreateFrame("Frame")  >>>>> Upper case F here
  3. f:RegisterEvent("GUILD_ROSTER_UPDATE")
  4. f:RegisterEvent("NAME_PLATE_UNIT_ADDED")
  5. f:SetScript("OnEvent",function(self,event,unit)
  6.     if event=="GUILD_ROSTER_UPDATE" then
  7.         local total=GetNumGuildMembers()
  8.         wipe(guildie)
  9.         for i=1,total do
  10.             local guid=select(17,GetGuildRosterInfo(i))
  11.             local localizedClass, englishClass, localizedRace, englishRace, sex, name, realm = GetPlayerInfoByGUID(guid)
  12.             if guid then
  13.                 guildie[guid]=true
  14.             end
  15.         end
  16.     elseif event=="NAME_PLATE_UNIT_ADDED" then
  17.         local guid = UnitGUID(unit)    
  18.         local localizedClass, englishClass, localizedRace, englishRace, sex, name, realm = GetPlayerInfoByGUID(guid)
  19.         if guildie[guid] then
  20.             PlaySound(416)  >>> Upper case S here
  21.             print(name)   >>> Displays name of guild member to know who .. you can use whatever alert system you want to display the message to make it more prominent if you want.
  22.         end
  23.     end
  24. end)   >>> Remember the bracket here
__________________
  Reply With Quote