View Single Post
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