Thread Tools Display Modes
12-13-06, 12:21 PM   #1
BJS2
A Defias Bandit
Join Date: Nov 2006
Posts: 3
target poisoned

how would i find out if my target is poisoned with [Deadly Poison]
or when my weapon casts [Deadly Poison]

thanks
  Reply With Quote
12-13-06, 04:38 PM   #2
Flickerstreak
A Deviate Faerie Dragon
Join Date: Dec 2006
Posts: 19
Code:
  local name, rank, icon, count, type = UnitDebuff("target","Deadly Poison")
That usage of UnitDebuff is new in 2.0 (previously you needed to pass the debuff slot ID, an integer 1-16, for the second argument, and iterate over them all).

That should get whether the target is poisoned or not (all returns would be nil if the debuff is not active). Note there is a ~0.5sec delay between a spell being cast and its debuff appearing, nominally the server round-trip time.

You need to know the name of the debuff, not the name of the spell/ability that caused it, to get the status. Fortunately for all the rogue poisons they're the same (I think)

If you want to collect data when your weapon poisons something, you'll need to hook an event. As far as I can tell there isn't a specific one, you could hook the combat events, which is a bit of a more advanced topic.

The relevant events you're looking for are:

CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE (debuff type poisons like deadly, wound, crippling, mind-numbing)
CHAT_MSG_SPELL_SELF_DAMAGE (instant poison)

You'd have to parse the message and filter for each poison name.
  Reply With Quote
12-15-06, 12:40 AM   #3
BJS2
A Defias Bandit
Join Date: Nov 2006
Posts: 3
thanks this works
Code:
name, rank, icon, count, debuffType = UnitDebuff("target", 1);
if (debuffType == "Poison")then
but only if the debuff is in slot 1 how do i check for the other 15 slots.
  Reply With Quote
12-15-06, 01:09 PM   #4
Flickerstreak
A Deviate Faerie Dragon
Join Date: Dec 2006
Posts: 19
Just put a for loop around it. Like this:

Code:
for i = 1, 16 do
  local name, rank, icon, count, debuffType = UnitDebuff("target", 1)
  if (debuffType == "Poison")then
    -- do something here
  end
end
  Reply With Quote
12-15-06, 02:32 PM   #5
BJS2
A Defias Bandit
Join Date: Nov 2006
Posts: 3
ahhh cool thanks
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » target poisoned


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