Need help with a text display for Talents
I want this to show my talent spec (i.e 'Elemental', 'Holy' etc) but it won't! So I figured I ****ed up somewhere. This leads me here! :rolleyes:
Code:
--[[ |
From the looks of it, your script always returns the highest talent tab's info (1 if you haven't bought dual-spec, 2 if you have).
You may want to use GetActiveTalentGroup() to find out WHICH talents are active, and then query GetTalentTabInfo() with the result from it. |
Quote:
Code:
if GetActiveTalentGroup() == 1 then |
You're using GetTalentTabInfo incorrectly. The argument it takes is a talent tab number (back when they were tabs, now it's just left to right). Also, in your original script, you were just rewriting the variable name each time through your loop. GetNumTalentTabs always returns 3 (though it will return 4 for druids in 5.0) since we have 3 talent trees.
In addition, your variable name is nil when you try to use it in GetTalentTabInfo() since you made it a variable local only to the scope of your loop. (Sidenote: when doing this, it creates a brand new local variable called name 3 times the loop runs.) Finally, you're not actually checking your talents when your events fire. Just resetting the text. Use "PLAYER_LOGIN" rather than "PLAYER_ENTERING_WORLD". It only fires once, whereas PEW fires on each loading screen. As Taryble said, you need to call GetActiveTalentGroup() to see if you are in your primary spec or secondary spec (if dual specced). Then you need to pass that information to GetPrimaryTalentTree() to see which tab/tree you have selected as your 'spec' (ie, 2 if you're Marksman for a hunter). Since this is the tab/tree number, you pass *that* to GetTalentTabInfo() for its name. (Sidenote: if down the road you also want to see how many points are spent in this tree, you will need to tell it which spec you are looking at. You'd probably want to save the return of GetActiveTalentGroup() to a variable at this point.) This can be done all at once, rather than cluttering your code with variables (unless you need these variables later for something else). I'm going to assume that what you have in the OP is not the entirety of your code, so I'll just post the relevant bits. lua Code:
/edit: removed the local variables from the main chunk, since I make the CheckTalents() function just return the result to the :SetText() call directly. |
Interesting. Thank you so much! :)<3
|
A new problem arises!
It works as it's supposed to except for when you log in, I assume it's because the information isn't available when PLAYER_LOGIN fires, PLAYER_ENTERING_WORLD doesn't work either. It works after the first reload, but not before that. Full code: Code:
--[[ |
See if PLAYER_TALENT_UPDATE fires when that info is ready...
|
Quote:
|
All times are GMT -6. The time now is 10:06 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI