View Single Post
07-15-20, 09:34 AM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
A single frame can monitor multiple events or in this case, the same event for more than one unit.

Lua Code:
  1. local function AuraCheck(self, event, ...)
  2.     local unit = ...
  3.     if unit == "target" then
  4.         print("Target Aura changed!")
  5.     elseif unit == "pet" then
  6.         print("Pet Aura changed!")
  7.     end
  8. end
  9.  
  10. local f = CreateFrame("Frame")
  11. f:RegisterUnitEvent("UNIT_AURA", "target", "pet")
  12. f:SetScript("OnEvent", AuraCheck)

You can only register a maximum of two units with RegisterUnitEvent but if you need more, you could just use RegisterEvent and extend the unit checking in the event function.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote