WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Accurately Checcking Debuffs? (https://www.wowinterface.com/forums/showthread.php?t=6551)

Xerogen 10-14-06 05:48 PM

Accurately Checking Debuffs?
 
Alright, im wondering how to accurately check debuffs then stop my pet if it has a certain debuff.

First off, i know you use UnitDebuff, but where in the code would you put say:

Interface\\Icons\\Spell_Shadow_Possession?

This is what i got so far:

Code:

--Finding the spell
local findFear = "Spell_Shadow_Possession"

function Warlock_OnLoad()
        if( DEFAULT_CHAT_FRAME ) then
                DEFAULT_CHAT_FRAME:AddMessage("Smart Target");
        end
end

function isUnitDebuffUp(sUnitname, sDebuffname)
  local iIterator = 1
  while (UnitDebuff(sUnitname, iIterator)) do
    if (string.find(UnitDebuff(sUnitname, iIterator), sDebuffname)) then
      return true
    end
    iIterator = iIterator + 1
  end
  return false
end

function isTargetDebuffUp(sDebuffname)
  if not sDebuffname then dbg("isTargetDebuffUp:sBuffname empty")return false end;
  return isUnitDebuffUp("target", sDebuffname)
end;

function isFeared()
        if UnitIsDeadOrGhost("target") then return false end;
        if UnitIsFriend("player", "target") then return false end;
        return isTargetDebuffUp(findFear)
end;

function petWait()
        if(isFeared() == true) then PetWait();
        end
end

At first it works, but i have to press my pets atk key and fear at nearly the same time. Then it pretty much doesnt do it =/. Anyone know what may be causing this?

Zeksie 10-18-06 07:15 AM

Quote:

Originally Posted by Xerogen
At first it works, but i have to press my pets atk key and fear at nearly the same time. Then it pretty much doesnt do it =/. Anyone know what may be causing this?

You're probably just not checking for the debuff at the right times. Need to watch for UNIT_AURA with arg1 as the unit with the debuff and check every time this comes up.


All times are GMT -6. The time now is 10:32 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI