Photogenic 24 Posted July 31, 2017 Share Posted July 31, 2017 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 More sharing options...
reapler 154 Posted July 31, 2017 Share Posted July 31, 2017 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. Link to comment https://wrobot.eu/forums/topic/6650-solved-how-to-detect-debuff-type/#findComment-30159 Share on other sites More sharing options...
Photogenic 24 Posted July 31, 2017 Author Share Posted July 31, 2017 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 https://wrobot.eu/forums/topic/6650-solved-how-to-detect-debuff-type/#findComment-30160 Share on other sites More sharing options...
reapler 154 Posted July 31, 2017 Share Posted July 31, 2017 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 https://wrobot.eu/forums/topic/6650-solved-how-to-detect-debuff-type/#findComment-30161 Share on other sites More sharing options...
Photogenic 24 Posted July 31, 2017 Author Share Posted July 31, 2017 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 https://wrobot.eu/forums/topic/6650-solved-how-to-detect-debuff-type/#findComment-30162 Share on other sites More sharing options...
iMod 99 Posted July 31, 2017 Share Posted July 31, 2017 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 Photogenic 1 Link to comment https://wrobot.eu/forums/topic/6650-solved-how-to-detect-debuff-type/#findComment-30164 Share on other sites More sharing options...
reapler 154 Posted July 31, 2017 Share Posted July 31, 2017 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. Photogenic 1 Link to comment https://wrobot.eu/forums/topic/6650-solved-how-to-detect-debuff-type/#findComment-30165 Share on other sites More sharing options...
Photogenic 24 Posted July 31, 2017 Author Share Posted July 31, 2017 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 https://wrobot.eu/forums/topic/6650-solved-how-to-detect-debuff-type/#findComment-30166 Share on other sites More sharing options...
thetaxi 1 Posted April 21, 2023 Share Posted April 21, 2023 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> Link to comment https://wrobot.eu/forums/topic/6650-solved-how-to-detect-debuff-type/#findComment-68069 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now