July 31, 20178 yr 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.
July 31, 20178 yr 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.
July 31, 20178 yr Author 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"
July 31, 20178 yr 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")
July 31, 20178 yr Author 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.
July 31, 20178 yr 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
July 31, 20178 yr 4 minutes ago, iMod said: EDIT: Nvm reapler still wrote that it is c# code 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.
July 31, 20178 yr Author 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!
April 21, 20233 yr 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<bool>(@" 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