Jump to content

Detect Magic Debuff and cast spell by ID or name


thetaxi

Recommended Posts

Working in XML and cannot get this to work.  I have tried both lua script and C#code and still not working.

   First the lua script

image.thumb.png.3dec486f41a3ce672632ec2ffa9c77c2.png

image.thumb.png.b53233fdd867e0851b174dd70594895a.png

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

 

Ive also tried this

 

image.thumb.png.86be81811f214b3a95e06850304d2a7c.png

      <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
Share on other sites

[D] 08:45:24 - [FightClass] CastSpellByID(100503); - NeedToRun time to execute: 27
[D] 08:45:24 - [FightClass] CastSpellByID(100503); - NeedToRun = false - condition
[D] 08:45:24 - [FightClass] CastSpellByID(100503); - NeedToRun time to execute: 33
[D] 08:45:24 - [FightClass] CastSpellByID(100503); - NeedToRun = false - condition
 

Link to comment
Share on other sites

When you run your Lua code (in "dev... tools"), it works ? try to add a print in you code to debug it, like that :

for i=1,40 do
    local name, rank, icon, count, debuffAuraType = UnitAura("player", i);
    if debuffAuraType == "Magic" then
        anyCurse = true;
    	print("true")
        return;
    end
end
print("false")

 

Link to comment
Share on other sites

Its not working.  The debuff is custom so i dont think its being picked up.  How can i adapt this to use spellID which i know.  I can just write a couple of options for different spell ids

 

I confirmed it worked with other magic but not these custom spells.

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