Thread Tools Display Modes
Prev Previous Post   Next Post Next
01-08-21, 04:39 PM   #1
labmixz
A Defias Bandit
Join Date: Jan 2021
Posts: 2
Iterating through all players in raid for buff

I'm sure this has been answered 1000x over, but trying to search on [these] forums, with the keywords I've been using hasn't brought me any results.

I'm looking to iterate over all the players in a raid, scanning for a buff. Without getting it to be too complex. Just wondering what the best method for doing this is? Lets say I want to look for Shadowcore Oil [spell id: 320798].


One tutorial I've found, has something like below. However, I can't see how this would iterate through all players in the raid. This seems more like it's iterating through the buffs on the player, which I need to do as well, just need to expand it to also include every other play (in raid).
Code:
local buffFound = 0
for i=1,40 do
    local name, icon, _, _, _, etime = UnitBuff("player",i)
    if name == "Shadowcore Oil" then
        buffFound = buffFound + 1
    end
end
Thanks in advance!

Edit: Of course I put this in the wrong forum :'( If someone could move it, that would be great.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Iterating through all players in raid for buff


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