zeeb 4 Posted October 7, 2018 Share Posted October 7, 2018 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! Link to comment https://wrobot.eu/forums/topic/10230-solved-cancel-action-in-fight-class-need-help/ Share on other sites More sharing options...
Matenia 628 Posted October 7, 2018 Share Posted October 7, 2018 For the code you want, just call Lua.LuaDoString("SpellStopCasting()") to cast your spell. Maybe insert a sleep for 50 ms afterwards zeeb 1 Link to comment https://wrobot.eu/forums/topic/10230-solved-cancel-action-in-fight-class-need-help/#findComment-48373 Share on other sites More sharing options...
Andoido 75 Posted October 7, 2018 Share Posted October 7, 2018 (edited) 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 October 7, 2018 by Andoido Link to comment https://wrobot.eu/forums/topic/10230-solved-cancel-action-in-fight-class-need-help/#findComment-48404 Share on other sites More sharing options...
zeeb 4 Posted October 12, 2018 Author Share Posted October 12, 2018 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) Link to comment https://wrobot.eu/forums/topic/10230-solved-cancel-action-in-fight-class-need-help/#findComment-48570 Share on other sites More sharing options...
zeeb 4 Posted October 14, 2018 Author Share Posted October 14, 2018 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! Link to comment https://wrobot.eu/forums/topic/10230-solved-cancel-action-in-fight-class-need-help/#findComment-48638 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