Originally Posted by Vladinator
You can put the code that updates the talent information to run each time the events fire for entering world and talent changes: "PLAYER_ENTERING_WORLD" and "ACTIVE_TALENT_GROUP_CHANGED".
Note that the PLAYER_ENTERING_WORLD event will fire each time you get a loading screen, if you only need it to run once at login then you can use "PLAYER_LOGIN" instead but it's up to you, if the update function is so small it's not a performance impact at all I'd put it to run at entering world like suggested.
Just an example, haven't actually tried it:
Code:
local class, primary, anim -- you can then use these anywhere in the file, think of them like "global variables" only for the file itself
local f = CreateFrame("Frame"):
f:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
f:RegisterEvent("PLAYER_ENTERING_WORLD")
f:SetScript("OnEvent", function(f, event, ...)
_, class = UnitClass("player")
primary = GetPrimaryTalentTree(false, false)
if class == "DEATHKNIGHT" then
if primary == 1 then
anim = {enable = true, animhealth = 7, animmana = 9, classcolored = false, powertypecolored = false, healthmultiplier = 0.5, manamultiplier = 1, healthdecreasealpha = true, manadecreasealpha = true}
elseif primary == 2 then
anim = {enable = true, animhealth = 27, animmana = 9, classcolored = false, powertypecolored = false, healthmultiplier = 0.5, manamultiplier = 1, healthdecreasealpha = true, manadecreasealpha = true}
else
anim = {enable = true, animhealth = 28, animmana = 9, classcolored = false, powertypecolored = false, healthmultiplier = 0.5, manamultiplier = 1, healthdecreasealpha = false, manadecreasealpha = true}
end
end
end)
|
thanks im gonna start tinkering!.