Jump to content

Recommended Posts

SOLVED:

            else if (FrostNova.IsSpellUsable && ObjectManager.Target.GetDistance >= 6 && ObjectManager.Target.GetDistance <= 10 && !ObjectManager.Target.HaveBuff("Frost Nova") && !ObjectManager.Target.HaveBuff("Frostbite") && ObjectManager.Target.HealthPercent >= 20)
            {
				Lua.LuaDoString("SpellStopCasting()");
				Thread.Sleep(50);
				fightState = fightingStateEnum.TargetClose;
				return;
            }


I'm using this for Frost Nova, however it never casts it if Frost Bolt is already casting, I need help to implement code so that when the conditions are met, the current action is canceled:

            else if (FrostNova.IsSpellUsable && ObjectManager.Target.GetDistance >= 6 && ObjectManager.Target.GetDistance <= 10 && !ObjectManager.Target.HaveBuff("Frost Nova") && !ObjectManager.Target.HaveBuff("Frostbite") && ObjectManager.Target.HealthPercent >= 20)
            {
                fightState = fightingStateEnum.TargetClose;
                return;
            }

I've tried a inserting a key stroke but I'm far too noob to efficiently construct C# code.


Any help would be greatly appreciated!

run lua code

 

SpellStopCasting();
SpellStopCasting();
CastSpellByName("Frost Nova");

or cast spell by ID.

CastSpellByID(1234)
CastSpellByID(1234, 'target')

 

or C# Code

wManager.Wow.Helpers.SpellManager.CastSpellByIdLUA(1234);
wManager.Wow.Helpers.SpellManager.CastSpellByIdLUA(1234, "target");
Edited by Andoido

Thanks guys for your inputs, I simply want my fight class to stop any action when the mob is within range of Frost Nova, currently it doesnt fire off Frost Nova whenever my character is casting.

But how would I implement it in the current script I'm using? (The script from my first post)

On 10/7/2018 at 10:57 AM, Matenia said:

For the code you want, just call 

Lua.LuaDoString("SpellStopCasting()") to cast your spell. Maybe insert a sleep for 50 ms afterwards 


Like this?

            else if (FrostNova.IsSpellUsable && ObjectManager.Target.GetDistance >= 6 && ObjectManager.Target.GetDistance <= 10 && !ObjectManager.Target.HaveBuff("Frost Nova") && !ObjectManager.Target.HaveBuff("Frostbite") && ObjectManager.Target.HealthPercent >= 20)
            {
				Lua.LuaDoString("SpellStopCasting()");
				Thread.Sleep(50);
				fightState = fightingStateEnum.TargetClose;
				return;
            }

It seems to work, but is "Thread.Sleep(50);" really the right way to implement a delay?
Also isn't it better with a Sleep of 1500ms, due to Global Cooldown being 1,5 sec?
Do tell me if you can spot any obvious problems with this.

Thanks guys for your help!

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