Jump to content

[Solved] How to detect debuff Type ?


Recommended Posts

Hello,

 

I want an Lua script to detect debuff type only. Like if its  magic / poison / curse..etc If its poison = Cast my spell..?

 

I don't want to type debuff names such as Crippling, Wound....etc. That would be very very long list, I just want to check the debuff "type" and cast my spell based on that.

 

 

Link to comment
Share on other sites

2 minutes ago, reapler said:

Hello, i guess you need this in .xml fightclass? If yes you may specify what it should return or in which context you need this.

Well basically, I added Abolish poison in my fightclass which is .xml. And I want to Cast Abolish poison whenever I am inflected by a poison using condition "Lua script"

Link to comment
Share on other sites

So i've researched a bit, because i'm not .xml fan :)

This snippet can be pasted, if you add a new condtion on your spell with "C Sharp Code" in the right pane on the textbox "Value":

                                Lua.LuaDoString<bool>(@"
                                    for i=1,25 do 
	                                local _, _, _, _, d  = UnitDebuff('player',i);
	                                if d == 'Poison' then
                                    return true
                                    end
                                end")

 

Link to comment
Share on other sites

19 minutes ago, reapler said:

So i've researched a bit, because i'm not .xml fan :)

This snippet can be pasted, if you add a new condtion on your spell with "C Sharp Code" in the right pane on the textbox "Value":

                                Lua.LuaDoString<bool>(@"
                                    for i=1,25 do 
	                                local _, _, _, _, d  = UnitDebuff('player',i);
	                                if d == 'Poison' then
                                    return true
                                    end
                                end")

 

This didn't work..Sorry for the trouble my friend and I appreciate your help.

Link to comment
Share on other sites

9 minutes ago, lonellywolf said:

This didn't work..Sorry for the trouble my friend and I appreciate your help.

This is a C# condition. If you want to use raw lua just take the lua command (the string part) and put it into your lua condition.

 

EDIT: Nvm reapler still wrote that it is c# code :laugh:

Link to comment
Share on other sites

4 minutes ago, iMod said:

EDIT: Nvm reapler still wrote that it is c# code :laugh:

Yep, that's not a secret that i love c# ;)

13 minutes ago, lonellywolf said:

This didn't work..Sorry for the trouble my friend and I appreciate your help.

I've tried on wotlk, it works flawless: Abolish Poison test.xml

Dunno how it will work on tbc, but in the wow api i haven't found any considerable changes.

Link to comment
Share on other sites

3 minutes ago, reapler said:

Yep, that's not a secret that i love c# ;)

I've tried on wotlk, it works flawless: Abolish Poison test.xml

Dunno how it will work on tbc, but in the wow api i haven't found any considerable changes.

I copied it from your sample file and worked!  I think I had some spaces or something the first time! THANK YOU SO MUCH!! Thats amazing!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...