Checking for specific buff/debuff on target?
I've been going crazy trying to figure this out, lol.
I've checked http://wowprogramming.com and http://www.wowwiki.com, but I'm sure that doing this is probably going to be complicated as the only relevant functions I've found are UnitAura, Unitbuff, UnitDebuff. I've also checked out a few addons, but I'm having trouble decoding it. I'm still quite fresh as far as lua script goes, so any tips or ideas would help. |
What are you trying to do with this once you've checked for a specific buff/debuff?
All three of those functions will return nil if the buff/debuff you are looking for is not found on the specified unit. Example: if UnitAura("player", "buff name") then etc etc |
The solution was simple... no wonder it took me so long to figure out, lol.
I'm mostly just playing with it to try to learn how to write basic addons so I can move up to more complex ones later on. I was trying to write an addon that adds a button that checks to see if the target has Flame Shock on, and if it does it'll cast Earth Shock instead. I figured it'd be a good place to start as far as learning goes. |
Well, your button cannot have that smart logic to know what spell to cast. But it can tell *you* to cast Earth Shock instead.
|
The following will (theoretically) place a 60x60 icon in the center of your screen that is displayed only when you have a hostile target. When that target has the Flame Shock debuff, it will show the Earth Shock icon; otherwise it will show the Flame Shock icon.
Code:
local f = CreateFrame("Frame", "MySpellSuggestionFrame", UIParent) In this case, I'd suggest setting up a macro that casts Flame Shock on shift-click/press, or Earth Shock otherwise; that's what I use on my shaman. |
Thanks for the tips. =)
|
All times are GMT -6. The time now is 06:51 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI