Paladin class bar wont show first login
Hey, everyone. I do not post here very often though I do lurk a lot. As I love seeing what add-ons people are making. I'm going to ask for a bit of help and guidance here so bare with me.
Currently, my paladin class bar (HolyPower) won't show on the first login. If you reload it will show. I will show the code I am using for this and where I am placing the code. Currently, for the modules for class power, I am using this. Lua Code:
Now I have to spawn this all in my unit frame code which is very long. I'm going to just place it in a gist if you all do not mind. https://gist.github.com/Kkthnx/4b1e3...5764bfd7aa9220 Idk why it will not spawn on the first login. Any advice would help. Thank you kindly. Oh here is where I place the code. https://gist.github.com/Kkthnx/4b1e3...rames-lua-L239 https://gist.github.com/Kkthnx/4b1e3...rames-lua-L252 https://gist.github.com/Kkthnx/4b1e3...rames-lua-L600 |
Maybe I'm missing it, but I don't see a register to PLAYER_LOGIN or PLAYER_ENTERING_WORLD, either of which would spawn the frame on first login
|
Quote:
|
Alright so after some testing. It seems like
Lua Code:
|
Register the PLAYER_SPECIALIZATION_CHANGED event.
Where are you using GetSpecialization()? It's not in the code shown. PLAYER_SPECIALIZATION_CHANGED fires before PLAYER_LOGIN so GetSpecialization() should be usable by then even on a cold login. |
Quote:
Lua Code:
returns nil on the first login. So when I am checking in my code for Lua Code:
K.Spec being GetSpecialization() it won't work first login. Preventing the HolyPowerBar from appearing until the player manually /reload their UI and it will work fine from then on out. I run it out of my Init.lua file. Lua Code:
Going further into this. If I comment the code out checking for the spec. It works first login. So this is why I feel like Its not there on a first login. |
I don't see where
Code:
AddOn.Spec = GetSpecialization() or 0 |
Quote:
Lua Code:
|
All that Addon.xxx = yyy (well, anything requiring character or other addon data) should at least go into the OnEvent script under a
Code:
if event == "PLAYER_LOGIN" then you will have to change Code:
Loading:SetScript("OnEvent", function() Code:
Loading:SetScript("OnEvent", function(self, event) |
In the long run you are better off to create your own special power bar frame rather then reusing the existing Blizzard ones, i havn't done this for every special bar but here is my combo frame, which looks (even better since the default combo frame using broken textures)/behaves exacly as the default one, just this is your own:
Lua Code:
All you have to do is to :SetParent, :SetPoint after this and it works out of the box. |
I had a similar issue with my "arrows" a few weeks back.
Here's my code for my class bars, hope it helps :) Lua Code:
|
All times are GMT -6. The time now is 06:28 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI