Quantcast
WoWInterface - View Single Post - GetTalentInfo returns nil when zoning into time-walking dungeons, arena, battleground
View Single Post
02-24-18, 05:00 PM   #1
Eungavi
A Theradrim Guardian
Join Date: Nov 2017
Posts: 64
GetTalentInfo returns nil when zoning into time-walking dungeons, arena, battleground

Hey!

So, one of my addon has a frame that listens to ACTIVE_TALENT_GROUP_CHANGED event which calls GetTalentInfo to check whether the specific talent is selected or not when its fired.

I honestly dunno why, but GetTalentInfo seems to be returning a nil value when the player zones into time-walking dungeons, arena and battleground.

Here's a code snippet:

Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
  3. f:SetScript("OnEvent", function(self, event, ...)
  4.     self[event](self, ...)
  5. )
  6.  
  7. function f:ACTIVE_TALENT_GROUP_CHANGED()
  8.     local _, _, _, selected = GetTalentInfo(7, 1, 1)
  9.  
  10.     if selected then
  11.         objectA:Show()
  12.     else
  13.         objectA:Hide()
  14.     end
  15.  
  16.     _, _, _, selected = GetTalentInfo(1, 1, 1)
  17.  
  18.     if selected then
  19.         objectB:Show()
  20.         objectB:RegisterEvent("PLAYER_TARGET_CHANGED")
  21.     else
  22.         objectB:Hide()
  23.         objectB:UnregisterEvent("PLAYER_TARGET_CHANGED")
  24.     end
  25. end

Both, objectA and objectB are hidden when I enter those zones and I'll have to reload ui to see them again
(This function is the only part where it manages those objects' visibility)

What would be causing this and would there be any possible solutions?

Last edited by Eungavi : 02-24-18 at 05:06 PM.
  Reply With Quote