UnitName() returning "Unknown Entity"
This is a strange bug that I'm not sure why is occuring. My set name function for my party mod uses UnitName("party1") for example to get the first party members name, and it works most of the time. Under certain conditions though, it returns Unknown Entity for usually all but one of the party members and I can't figure out why.
The events that I use to catch it are: Code:
elseif ((event == "PARTY_MEMBERS_CHANGED") or (event == "PARTY_LEADER_CHANGED")) then MembersUpdate just populates all the different bits of information accordingly, which shouldnt be the problem, but justin case, here's that function. Code:
function Perl_Party_MembersUpdate() And finally, here is the set name function that works perfectly after a /console reloadui Code:
function Perl_Party_Set_Name() To save some time looking at what WoWWiki says about this, I'll just put it here. Quote:
|
your definatly running that after your in the group right? and not just on invite
|
pretty sure. I've looked at the default wow ui and they use the same events. I also had PARTY_MEMBER_ENABLE and PARTY_MEMBER_DISABLE in the elseif but it made no difference. also, the reason its weird is because its still reporting usually one of the members names correctly if theres 3 other party members. also, if i log into the game and do a /console reloadui, then get the invite, it works perfectly. which just adds to the wtf factor of this problem.
|
why dont you throw in a getnumpartymembers() thing just in case?
that would catch it I think I assumed you were but sometimes we overlook the most obvious [edit] change for partynum=1,4 do to partytotal = GetNumPartyMembers() if (partytotal > 0 ) then for partynum = 1 , partytotal do ... and that *might fix it* |
i'll try, but it's correctly displaying the number of people in the group. all the frames that should appear are there. it's just that i get the unknown entity value instead of a name. the for loop literally just displays or hides the party frames, never had any issues with it. kind of along these lines, in my hopeless attempt to fix the issue, i made this set name function:
Code:
--function Perl_Party_Set_Name() --Failed attempt at the Unknown Entity fix |
Just a quick "update" if you will. After doing some xml tweaking I did a few /console reloadui's and joined a group a few minutes later. Apparently the reloadui only works after you join a group since this screenshot is what happened after the initial reloadui and before a reloadui after joining the group (wow that sounds complicated).
click here for the pic so yea, still totally lost as to why this is happening. |
rofl yeah thats weird...it might be that your in Orgrimarr though and its just lag
I dunno I always assume the easiest answer...its just a stab in the dark.. |
hah, i wish. unfortunately it happens anywhere.
|
does the unkown unit resolve itself shortly after or does it stay an unknown entity?
|
if someone new gets invited to the group, it resolves itself. if you kick someone and reinvite it fixes the problem. zoning fixes the issue (i think) since that's basically a console reloadui.
|
maybe toss in a
if(UnitName("PartyN") ~= "Unknown Entity") then --Update your player frame names else while UnitName("PartyN") == "Unknown Entity" do end --Update your player frame name end although thats going to lock up your system while it tries to get the actuall name(and if someone is actually named Unknown Entity theyre screwed prolly a better way to accomplish it in the on update function rather than locking up your system It might even crash wow test it by doing a /script DEFAULT_CHAT_FRAME:AddMessage(UnitName("PartyN") for one of the party members thats displayed as Unknown Entity [edit] in all honesty your prolly alot more proficient at LUA than me. |
heh, i've tried that already too. of course i made it into a loop to ensure that it got the name. too bad it just ended up hardlocking wow. and when you have it print to the chat window it also just keeps spamming unknown ent, so something else is definately not triggering correctly.
|
did you try to do a
/script DEFAULT_CHAT_FRAME:AddMessage(UnitName("PartyN") for one of the party members thats displayed as Unknown Entity to see if it returns a name if it does try the code changes below...dunno might help...not so much a solution as a work around(if it works) Code:
function Perl_Party_Set_Name() --Failed attempt at the Unknown Entity fix then in your OnUpdate Handler toss in a if(WeirdBehaviorFlag ) then function Perl_Party_Set_Name() end -- check the party again if there is an "Unknown Entity" and see if that gets it to load |
the problem with using the global flag is that theres no documentation on when it is set and reset. i'll try it out though if my current tweak doesn't work.
i changed my members update function to: Code:
function Perl_Party_MembersUpdate() edit: i guess it didn't keep working for very long, oh well. |
did you get a chance to try my code tweak
Basically it should unset at the start of that function and be set only if a Unknown gets returned) I have a feeling its lag related as I seem to remember getting unit unknown(sometimes for a few minutes even) with the default UI but it really shouldnt be happening ALL the time |
my hat goes off to you sir. in the tests i've been running it seems to be working just fine. granted now i have to hit an if statement on every event, but i'm saving enough cpu cycles elsewhere over the default bliz ui to not care. i'll continue to test this fix and get back to you :) can't believe it's finally working right. thanks a ton!
|
lol I figured that would fix it...its not the prettiest solution but it works
|
honestly, im totally shocked it worked since when i dropped a while loop in it just hardlocked wow. i really don't understand why this works and the loop didn't.
|
I believe the solution to your problem is to register for the UNIT_NAME_UPDATE event. This event fires when a unit's name changes with arg1 being set to the unit whose name has been updated. When you join a party, I don't believe that the party member's names are guaranteed to be available until this event fires for each one because the client is still retrieving the information in order to make it available to the UI system.
On a related note, I believe the same is true of party member's levels and the UNIT_LEVEL event. |
i'll definately take a look into this, thanks for the advice :)
|
All times are GMT -6. The time now is 10:58 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI