"PLAYER_ALIVE" Alternative?
Is there any particular reason why PLAYER_ALIVE doesn't fire on log in?
I've read the events to which it fires, but using it in the addon load sequence hasn't worked for me. It just simply isn't triggering. Any ideas? |
I personally use "PLAYER_ENTERING_WORLD" for pretty much everything exept savedvar for which I use "ADDON_LOADED".
|
I used PLAYER_ENTERING_WORLD as well as VARIABLES_LOADED. I use ADDON_LOADED when I need to but most of the time I can avoid it.
|
PLAYER_ALIVE fires for first logon but not for ReloadUI.
As a rule of thumb: If you need to delay initialization of something on a clean start (entering the game from the account selection level) you can use PLAYER_ALIVE as it will fire after PLAYER_ENTERING_WORLD. If you need to do the same after a reload (or entering the game after logging out to the character selection screen only) you can use PLAYER_ENTERING_WORLD and it will have the same effect. (things that might not be available to the client at P_E_W on a clean start will be after a reload and for the rest PLAYER_ALIVE is usually delayed enough) Bottomline if you need to use one of them, use both :p and unregister when you've done what you want to do. |
Yeah, Dridzt is right, it will only fire on a "cold" login so to speak. If you're using PLAYER_ALIVE to know when talents are available you can register for PLAYER_ENTERING_WORLD and when it fires do this:
lua Code:
|
I usually use PLAYER_LOGIN. It fires when everything's ready and only fires at loading.
|
Quote:
I don't recall being able to use player entering world either, but I may have been mistaken. I think I would set a primary OnUpdate function to keep checking until talents were available, then when they were, switch back to the regular onupdate. |
Well, PLAYER_ENTERING_WORLD is used for when zoning in and out of instances as well and from what wowwiki says is at the point where all frames need to be completed for display. I suspect that means that everything should be available at this stage.
|
According to the info on WoWWiki, talents are not available until PLAYER_ALIVE (unless you're doing a /reload).
http://www.wowwiki.com/AddOn_loading_process |
Thank you all for your suggestions. The player alive trigger seems to only work on a non' player generated load screen. (ie /reload )
Which I had no clue of, anyway thanks again for your suggestions. My problem has been solved :) Edit: And for those curious, I was intending on using it for talent data. And rather than do multiple calculations, I'd much rather have it run only once and properly :). |
PLAYER_ALIVE fires when any spell resurrects the player (after the player has accepted of course), this also triggers for the LOGINEFFECT spell that procs when you log in (I guess you get resurrected from the void or something :rolleyes:). Note it doesn't fire when the player runs to their body and resurrects that way. It isn't that relevant to the loading process, but do whatever you have to.
|
Quote:
|
So I was making something that requires knowing when talent information is available and that's PLAYER_ALIVE on login and basically any time after on /reload's or loading screens.
Now I don't want to save variables if it's not necessary but I'm not finding another way of doing this. The only way I can think of is saving a variable to say we're logged in and talents are available when first logging in (first PLAYER_ALIVE.. does this fire on login to Ghost/Dead?) and then resetting it when logging out. Edit: Wrote PLAYER_LOGIN in first sentence when I meant PLAYER_ALIVE Edit2: PLAYER_ALIVE does fire as ghost on log in. |
Quote:
You could register PLAYER_LOGIN to capture the first login, and then when you handle that event you unregister PLAYER_LOGIN and register PLAYER_ENTERING_WORLD. This will allow you to capture all login and reloadui scenarios without having to use saved variables. It will have the disadvantage of being called everytime you get the loading screen though (Hearth, portal, entering/leaving instances, etc.) something like this: Code:
local myFrame = CreateFrame('Frame') |
As you probably noticed I edited my post a bit. The talent information is not available at PLAYER_ENTERING_WORLD (or PLAYER_LOGIN as it fires before P_E_W). When PLAYER_ALIVE fires during logins that's when the information is available.
Edit: Basically, on first log in, wait for PLAYER_ALIVE then register P_E_W and unregister PLAYER_ALIVE and only use P_E_W. Problem there is when a user does /reload PLAYER_ALIVE won't fire and P_E_W wouldn't get registered. |
Did you look at the code I posted earlier?
If you register for PLAYER_ENTERING_WORLD and when it fires you check if talent-data is available. If not, this is a fresh login so register PLAYER_ALIVE. If the data is available, it was a /reload. Or am I misunderstanding what you are after? |
Uhhh..... Uhhhh.... :rolleyes:
I should probably stop doing this stuff when I'm tired... but it's like the only time I have |
All times are GMT -6. The time now is 12:42 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI