Thread Tools Display Modes
10-14-06, 05:48 PM   #1
Xerogen
A Deviate Faerie Dragon
 
Xerogen's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2006
Posts: 16
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?

Last edited by Xerogen : 10-14-06 at 07:23 PM.
  Reply With Quote
10-18-06, 07:15 AM   #2
Zeksie
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 24
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.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Accurately Checcking Debuffs?


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