Quantcast
event SPELL_AURA_APPLIED occurs on every loading screen - WoWInterface
Thread Tools Display Modes
10-19-20, 11:41 AM   #1
ragunragun
A Murloc Raider
Join Date: Oct 2020
Posts: 4
event SPELL_AURA_APPLIED occurs on every loading screen

Hello,

I am playing a sound every time a player receives a buff but unfortunately this also occurs after each loading screen.
Since the player has +5 buffs after a loading screen the sound multiplies 5 times.
I would not like to play it after a loading screen.

Lua Code:
  1. local playerGUID = UnitGUID("player")
  2. local targetGUID = UnitGUID("target")
  3. local bossGUID = UnitGUID("bossN")
  4. local f = CreateFrame("Frame")
  5. local bossGUID = UnitGUID("boss")
  6.  
  7. f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  8. f:SetScript("OnEvent", function(self, event)
  9. self:OnEvent(event, CombatLogGetCurrentEventInfo())
  10. end)
  11.  
  12.         function f:OnEvent(event, ...)
  13.         local timestamp, subevent, _, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = ...
  14.  
  15.             if subevent == "SPELL_AURA_APPLIED" and destGUID == playerGUID then
  16.                     a.Sound(SoundPackValue("buff_on_self"))
  17.             end
  18.         end

Is there a possibility to detect if the buff is applied by a player or an other player as a spellcast?
Or creating a variable that would reset itself after a loading screen after 3 seconds would be better?

What would be a good way to approach this issue?
  Reply With Quote
10-19-20, 12:14 PM   #2
ragunragun
A Murloc Raider
Join Date: Oct 2020
Posts: 4
I figured it out!

Lua Code:
  1. local noloadingscreen = true
  2. local function OnEvent(self, event, isInitialLogin, isReloadingUi)
  3.     if isInitialLogin or isReloadingUi then
  4.     else
  5.             noloadingscreen = nil
  6.         C_Timer.After(2, function()
  7.             noloadingscreen = true
  8.         end)
  9.     end
  10. end
  11.  
  12.  
  13.  
  14.             if subevent == "SPELL_AURA_APPLIED" and destGUID == playerGUID and noloadingscreen == true then
  15.                     a:SetTimer("buffup", 1)
  16.                     a.Sound(SoundPackValue("buff_on_self"))
  17.             end

Did the job.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » event SPELL_AURA_APPLIED occurs on every loading screen

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off