Jump to content

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
https://wrobot.eu/forums/topic/6650-solved-how-to-detect-debuff-type/
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"

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")

 

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.

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:

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.

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!

  • 5 years later...

Reviving this from way back.  I am trying to do this but with magic and coming up empty.  This is for 3.3.5

    <FightClassSpell>
      <FightClassConditions>
        <FightClassCondition>
          <ContionType>CSharpCode</ContionType>
          <Param xsi:type="FightClassConditionString">
            <Value>                                Lua.LuaDoString&lt;bool&gt;(@"
                                    for i=1,25 do 
                                    local _, _, _, _, d  = UnitDebuff('player',i);
                                    if d == 'Magic' then
                                    return true
                                    end
                                end")</Value>
          </Param>
        </FightClassCondition>
      </FightClassConditions>
      <SpellName>CastSpellByID(100503);</SpellName>
      <Priority>13</Priority>
      <CombatOnly>false</CombatOnly>
      <CheckIfKnow>false</CheckIfKnow>
      <CheckIfSpellUsable>false</CheckIfSpellUsable>
      <CheckSpellDistance>false</CheckSpellDistance>
      <CheckIfView>false</CheckIfView>
      <NotSpellIsLuaScript>true</NotSpellIsLuaScript>
      <Debug>true</Debug>
      <WaitDuringCasting>false</WaitDuringCasting>
    </FightClassSpell>

 

Ive also tried this

      <FightClassConditions>
        <FightClassCondition>
          <ContionType>LuaScript</ContionType>
          <Param xsi:type="FightClassConditionLua">
            <LuaScript>anyCurse = false;
for i=1,40 do
    local name, rank, icon, count, debuffAuraType = UnitAura("player", i);
    if name and debuffAuraType and debuffAuraType == "Magic" then
        anyCurse = true;
        return;
    end
end</LuaScript>
            <VarRet>anyCurse</VarRet>
            <ValueRet>true</ValueRet>
          </Param>
        </FightClassCondition>
      </FightClassConditions>
      <SpellName>CastSpellByID(100503);</SpellName>
      <Priority>13</Priority>
      <CombatOnly>false</CombatOnly>
      <CheckIfKnow>false</CheckIfKnow>
      <CheckIfSpellUsable>false</CheckIfSpellUsable>
      <CheckSpellDistance>false</CheckSpellDistance>
      <CheckIfView>false</CheckIfView>
      <NotSpellIsLuaScript>true</NotSpellIsLuaScript>
      <Debug>true</Debug>
      <WaitDuringCasting>false</WaitDuringCasting>
    </FightClassSpell>

 

 

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...