Thread Tools Display Modes
05-25-17, 04:24 AM   #1
OneZero
A Defias Bandit
Join Date: May 2017
Posts: 3
Post Check team

How to check if destName from UNIT_DIED is in my raid group. Lets say if boss kills someone from my raid addon will announce me
  Reply With Quote
05-25-17, 08:45 AM   #2
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
One way is to get the UnitFlag affiliation

Lua Code:
  1. local band = bit.band
  2. local raid = COMBATLOG_OBJECT_AFFILIATION_RAID
  3. local player = COMBATLOG_OBJECT_TYPE_PLAYER
  4.  
  5. local f = CreateFrame("Frame")
  6. local msg = "%s has died"
  7.  
  8. function f:OnEvent(event, timestamp, subevent, _, _, sourceName, _, _, destGUID, destName, destFlags)
  9.     if subevent == "UNIT_DIED" then
  10.         if band(destFlags, raid) > 0 and band(destFlags, player) > 0 then
  11.             -- unit is in your raid and is a player
  12.             print(format(msg, destName))
  13.         end
  14.     end
  15. end
  16.  
  17. f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  18. f:SetScript("OnEvent", f.OnEvent)

Last edited by Ketho : 05-25-17 at 08:57 AM.
  Reply With Quote
05-26-17, 05:43 AM   #3
OneZero
A Defias Bandit
Join Date: May 2017
Posts: 3
If I want to check if event happend in specific area can I use GetZoneText() or is there somethig better?
  Reply With Quote
05-26-17, 06:46 AM   #4
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
You can also use IsInInstance for pve/pvp/world zones or MapIDs but you're showing little effort and we don't know what you're specifically trying to do
  Reply With Quote
05-26-17, 09:59 AM   #5
OneZero
A Defias Bandit
Join Date: May 2017
Posts: 3
I'm just starting with Lua and addons and I want to add addition in one addon that I'm using. If someone dies in specific instance addon will write something in chat

Last edited by OneZero : 05-26-17 at 10:03 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Check team


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