Flashy name for nearby guild mates
Hi everyone, I noticed that when I travel there's sometimes people of my guild nearby but I miss them most times because there are a lot of people of other guilds all around.
Is it possible to create an addon that automaticaly detects people that are in the same guild than mine and change their name in a flashy color so I dont miss them anymore and I can /hug them? :) I would be grateful if you can share your knowledge with me. |
Just some general advice, what did you already try?
Did you use the addon search function on WoWInterface? Did you try googling first? https://meta.stackexchange.com/quest...ampire-problem |
You would need to have friendly nameplates turned on, and be in range for them to show.
|
You might want to have a look at how the person created this one and see if you can add guild related checks to modify similar items to your specifications.
https://www.wowinterface.com/downloa...ameplates.html If you are not knowledgeable enough to do this yourself then if you ask nicely the developer of that addon may add a guildie option to their addon. |
I tried this but it doesnt work :(
Quote:
|
You need to use GetGuildInfo to get the guild name of a unit such as the player.
https://wowpedia.fandom.com/wiki/API_GetGuildInfo All IsInGuild does is return whether someone is in a guild and doesn't take any parameters. Unfortunately, needing a unit name to execute means this will have to be someone you are looking at specifically "mouseover", "target" or in a group/raid with "raid2", "party2" etc. So, the next option to consider is looking at how nameplate addons *scan* the nameplate and extract the information. If one of them is the guild name you can then do your guild check once you have identified which guild the nameplate is showing. Unfortunately I haven't played with nameplates at all to know what is and isn't possible from that point of access. |
Any nameplate you see has a valid unit in the form of nameplaten where n goes up to 40. All functions that accept a unit work with nameplate units.
As for looking for nearby guildies, in my experience, it's better to maintain a local table of guildies and then compare players to that list. This bypasses the awkwardness of GetGuildInfo (which isn't reliable outside of inspect distance) as well as avoiding querying the guild roster each time. Lua Code:
EDIT: I forgot that GetGuildRosterInfo returns a GUID. Also, the code above is basically a modified version of my own code in an addon that deals with name-realm data coming from sources that don't include a GUID and only deals with those online. Below is a much simpler version of caching your guild. Lua Code:
|
Nice Kanegasi. Much easier than I thought it would be.
|
Quote:
Quote:
|
That should in theory play a sound when it creates the nameplate. So, as long as you have nameplates enabled, and you are in range of a guildie, you should get the sound alert when it shows the nameplate. You may still have to hunt it down amongst the mass of nameplates, unless you modify it as mentioned by Kanegasi
|
I tryed it with guildies nearby but it doesnt play any sound. I have friendly nameplates turned on. I dont know how to make it working. Its probably my noob brain that forgot something.
Here's what's in the core.lua file: Quote:
|
Actually, looking at your code there is an extra ')' in the guildie check.
-- If that doesn't help then the following debug steps may help narrow down the problem. Do a print(total) after setting total and make sure that it is returning a value other than 0 or 1. The for loop doing the work won't do anything if that value isn't set. Also, assuming it gets in that loop and sets the table up, add a print(event,unit) in the "NAME_PLATE_UNIT_ADDED" event code block to make sure it is being executed. To stop it from doing it tons of time put a counter at the top of the file and increment it each time the event is called and only print the event and unit values up to a certain count. Then, assuming that works as expected, put a print(UnitGUID(unit)) before the play sound to see that there is a value. If this prints and the sound doesn't happen, the sound is the problem. If it doesn't print the check isn't working as expected. As a side note for more details, once everything is working, you could try the following to get their name etc. local localizedClass, englishClass, localizedRace, englishRace, sex, name, realm = GetPlayerInfoByGUID(guid) I'm going to give this a quick spin though to make sure it works minus the guild checking side of things as my guildies are rarely on at the same time as me. |
Hmm .. not sure why but none of my debug prints are showing at all.
I have this code in place and I get none of the messages appearing. Lua Code:
Nevermind .. I forgot to add the lua file to the toc file .. newbie mistake *slaps head* Now that I have that minor thing working rofl. I am getting nameplateadded event triggering with a parameter of nameplate1 or nameplate2 with 4 players being referenced by them as they appear and then disappear and are recycled. Now to test the guildie part of the equation with my lowbie free account character. |
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:
|
Nice it plays the sound, thanks. I like a lot when it print the guildie name in the chat :)
Instead of a sound playing is there a way to just change the color of the name of the nearby guildie(s) so I can quickly diferenciate them from other people? I Tryed to replace Playsound(416) with showName = true, = CreateColor(0, 0.7, 0) but its not working (as always...) |
Adding this after the PlaySound line changed the color of the name of the player when the nameplate is created.
Lua Code:
|
Awesome. I wish I had your knowledge. Thanks all for the great help. Now I'm gonna hug all the guildies I see :D
|
Please what is the code to hide the healthbars below the names when nameplates are activated, I dont find it on wowwiki API. Its just for the aesthetic, no need healthbars when not in combat, right?
|
This is the xml file that describes the different frames
The one you want to look at is the one that shows parentKey = "UnitFrame" Under that is a section called parentKey = "healthBar" and some other bars. You would want to do a check for not InCombatLockdown and use nameplate.UnitFrame.healthBar:Hide() etc. But remember your code only executes when the nameplate is created ( comes back into range or you use Shift V to view them again ) so the bars may get redrawn if an update happens after your changes. I haven't tested this out but in theory thats all you will need to do if that is the only bar that is showing at first. When in combat the others may appear. |
Nice I added the code you gave above at line 23 and it works well and hide healthbars on guildies. But other people around that are not in my guild still have their healthbars under their name. Where else can I put nameplate.UnitFrame.healthBar:Hide() to hide other people healthbars?
Lua Code:
|
Just put it before the if guildie line to include the others. But you will then have to move the line starting with local nameplate = to the same place so you can access the nameplate object.
So instead of .. Lua Code:
It should look like this.. Lua Code:
This essentially hides the healthbar immediately when they first are shown ( but wow may show it again during its update routine ) and then does the guildie check before setting the text color and playing the sound if it is a guildie. |
Thanks it works like a charm!
I think the addon is complete now. Hope people will see this and use it as well to hug their guildies :) kisses to you Xrystal, Kanegasi and the others <3 |
All times are GMT -6. The time now is 02:46 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI