Hello,
I created this script for display a message whenever spell power get increased. I'd like to make the animation repeat only once. Are there better methods than the ones I'm using? What about spell power 'ping'?
Lua Code:
local fs = UIParent:CreateFontString(nil, "OVERLAY", "GameTooltipText")
fs:SetPoint("CENTER")
fs:SetFont("Fonts\\FRIZQT__.TTF", 24, "OUTLINE")
fs:SetText("Spell power increased!")
fs:SetAlpha(0)
fs.flasher = fs:CreateAnimationGroup()
fs.flasher:SetLooping("NONE")
fs.flasher:SetScript(
"OnUpdate",
function()
if fs:GetAlpha() == 0 and fs.flasher:IsPlaying() then
fs:Hide()
end
end
)
local fade = fs.flasher:CreateAnimation("Alpha")
fade:SetDuration(5)
fade:SetChange(-1)
fade:SetOrder(1)
local spellDmg = GetSpellBonusDamage(6)
local onupdate = CreateFrame("Frame")
local spellDmg = GetSpellBonusDamage(6)
onupdate:SetScript("OnUpdate", function(self,elapsed)
if GetSpellBonusDamage(6) > spellDmg then
fs:SetAlpha(1)
fs:Show()
fs.flasher:Play()
end
spellDmg = GetSpellBonusDamage(6)
end)