What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

Help with UnitCastingInfo notInterruptible

wulf

Community Developer
Joined
Dec 29, 2010
Messages
1,832
Reaction score
128
Hi guys,

Searched the forum and some dev code but could not find anyone attempting to use Lua to get notInterruptible from UnitCastingInfo.

I want to use my interupts only if the target has a spell i can interupt, rather than just use Me.CurrentTarget.IsCasting

Here is what I have for Casting:

Code:
public bool InterruptibleCasting(WoWUnit unit)
{
 	    int CastInterruptibleLua = Lua.GetReturnVal<int>("local name, subText, text, texture, startTime, endTime, isTradeSkill, DcastID, notInterruptible = UnitCastingInfo(" + unit + "); return notInterruptible", 0);
            Logging.Write(Color.Red, unit.Guid + " can interupt = " + CastInterruptibleLua);
            if (CastInterruptibleLua == 1) return true;
            else return false;
}

Note: There is an < int > at the end of Lua.GetReturnVal without the spaces (stupid html)

Here is what I have for Channel:

Code:
public bool InterruptibleChannel(WoWUnit unit)
{
            bool ChanInterruptibleLua = Lua.GetReturnVal<bool>("local name, subText, text, texture, startTime, endTime, isTradeSkill, DcastID, notInterruptible = UnitCastingInfo(" + unit + "); return notInterruptible", 0);
            Logging.Write(Color.Red, unit.Guid + " can interupt = " + ChanInterruptibleLua);
            if (ChanInterruptibleLua) return true;
            else return false;
}

Note: There is an < bool > at the end of Lua.GetReturnVal without the spaces (stupid html)

I feed it Me.Currenttarget so.. InterruptibleChannel(Me.Currenttarget)

It always returns false for channel and 0 for cast....what am I missing ?

Referenced:
UnitCastingInfo
UnitChannelInfo

any help appreciated :cool:



EDIT:

The below code works :confused:

Code:
Lua.DoString("local u,i=UnitCastingInfo;i=select(9,u\"target\")if u\"target\"and not i and IsSpellInRange(\"Skull Bash\",\"target\")==1 then CastSpellByName(\"Skull Bash\",\"target\")end", "Barkskin.lua");

Not ideal but......does anyone else have anything more elegant ?
 
Last edited:
Thanks for the reply Vastico!

I will try:

string myCurrentTarget = Me.CurrentTarget.ToString();

and feed it to:

public bool InterruptibleCasting(string unit) {}

let you know how it goes.
 
Yes the above worked thanks!
 
Hey now that I helped you could you help me get it working? I copied ur code and made alterations as you said it worked but it isn't.

Here's code:
public static bool CanInterrupt(object Unit)
{
int Interruptable = Lua.GetReturnVal<int>("local spell, _, _, _, _, _, _, _, interrupt = UnitCastingInfo(" + Unit + ") return interrupt", 1);
Logger.Logger.Log("Interruptable: {0}", Interruptable);
return false;
}

Always outputs 0
 
its better if you dont use lua, chances are you can make a method to do this without it.


for example here is my Spell Steal code.

Code:
        public bool SpellToSteal()
        {
            foreach (KeyValuePair<string, WoWAura> pair in Me.CurrentTarget.ActiveAuras)
            {
                WoWAura curAura = pair.Value;
                if (curAura.Spell.SpellEffect1.EffectType == WoWSpellEffectType.Heal)
                {
                    Logging.Write("CurrentTarget's Buff " + curAura.Name + " is healing him");
                    return true;
                }
            }
            return false;
        }

if you look at the spell effects and there some other stuff in there, you should be able to get what you want out of it.
 
I had a look at that and some of the other stuff but I can't identify where it says if it's Interruptible or not =s
 
could try something like:

Me.CurrentTarget.CastingSpell.CastTime > 0 && Me.CurrentTarget.CastingSpell.PowerType == WoWPowerType.Mana

or

Me.CurrentTarget.CastingSpell.School != WoWSpellSchool.Physical
 
Last edited:
could try something like:

Me.CurrentTarget.CastingSpell.CastTime > 0 && Me.CurrentTarget.CastingSpell.PowerType == WoWPowerType.Mana

or

Me.CurrentTarget.CastingSpell.School != WoWSpellSchool.Physical

Naa, some fights e.g. the Zul places the toxic people they cast Toxic Link, you cannot interrupt that but I am not sure how to check if we can.
 
@Vastico, sorry for not getting back to you, i just went with the Lua.DoString method in the first post, I cant remember why I did this.

I did have a thought about running most of the lvl85 dungeons and seeing what i could interupt (I have an addon that outputs to chat what spell i interupted) and then compiling a list of those spells in a public enum interuptableSpells(){} that i could call to check if the spell was interuptble before using my interupt......but....it would have to be updated, etc so abondoned that idea.

I like CodenameG's idea though.
 
@Vastico, sorry for not getting back to you, i just went with the Lua.DoString method in the first post, I cant remember why I did this.

I did have a thought about running most of the lvl85 dungeons and seeing what i could interupt (I have an addon that outputs to chat what spell i interupted) and then compiling a list of those spells in a public enum interuptableSpells(){} that i could call to check if the spell was interuptble before using my interupt......but....it would have to be updated, etc so abondoned that idea.

I like CodenameG's idea though.
I Like my Idea too.
 
Yes and if you read my response it doesn't have it in there so get off your ********* and help
 
Last edited by a moderator:
Yes and if you read my response it doesn't have it in there so get off your ****** and help
EXCUSE ME? we have done NOTHING but try and help you you wanna keep acting like a jerk. 3 day ban, you've been nothing but rude ever since you got here.
 
Back
Top