Stubenhocker 2 Posted July 11, 2017 Share Posted July 11, 2017 Hello I just want to know if anyone have some code for me for move back if a mob is freezed or rooted. How can I add such code in the fight class creator ? I'm a noob in coding like c#. I know the basics in c# but that's all. Thanks for answers . Link to comment https://wrobot.eu/forums/topic/6443-move-back-if-add-code-in-fightclass-editor/ Share on other sites More sharing options...
Droidz 2742 Posted July 15, 2017 Share Posted July 15, 2017 Hello, In fightclass general settings, in option "Additional C# code" add code like: static Main() { wManager.Events.FightEvents.OnFightLoop += (unit, cancelable) => { if (unit.IsValid && !ObjectManager.Me.IsCast && (unit.IsStunned || unit.Rooted)) { wManager.Wow.Helpers.Move.Backward(Move.MoveAction.PressKey, 1500); } }; } (code not tested) Pudge 1 Link to comment https://wrobot.eu/forums/topic/6443-move-back-if-add-code-in-fightclass-editor/#findComment-29418 Share on other sites More sharing options...
Droidz 2742 Posted July 16, 2017 Share Posted July 16, 2017 Others sample: static Main() { wManager.Events.FightEvents.OnFightStart += (unit, cancelable) => { robotManager.Helpful.Var.SetVar("CanBack", true); }; wManager.Events.FightEvents.OnFightLoop += (unit, cancelable) => { if (robotManager.Helpful.Var.Exist("CanBack") && robotManager.Helpful.Var.GetVar<bool>("CanBack") && unit.IsValid && !ObjectManager.Me.IsCast && unit.GetDistance < 15 && !TraceLine.TraceLineGo(unit.Position)) { var startPos = new Vector3(ObjectManager.Me.Position); var timer = new robotManager.Helpful.Timer(5 * 1000); try { wManager.Wow.Helpers.Move.Backward(Move.MoveAction.DownKey); while (!timer.IsReady && Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && !TraceLine.TraceLineGo(unit.Position) && unit.GetDistance < 30) { Thread.Sleep(10); } } catch { } finally { wManager.Wow.Helpers.Move.Backward(Move.MoveAction.UpKey); } if (TraceLine.TraceLineGo(unit.Position)) // if your target is now not in line of sight after back, disable this option for current combat robotManager.Helpful.Var.SetVar("CanBack", false); if (ObjectManager.Me.Position.DistanceTo(startPos) < 10 && unit.GetDistance < 30 && timer.IsReady) // if seem stuck (wall?) robotManager.Helpful.Var.SetVar("CanBack", false); } }; } (not tested) Matenia 1 Link to comment https://wrobot.eu/forums/topic/6443-move-back-if-add-code-in-fightclass-editor/#findComment-29452 Share on other sites More sharing options...
kraszus 5 Posted October 13, 2017 Share Posted October 13, 2017 Can anyone suggest some Additional C# code for a hunter to move back 5yds if he does not have aggro && target.distance <=5 yds? Would really appreciate it :) Link to comment https://wrobot.eu/forums/topic/6443-move-back-if-add-code-in-fightclass-editor/#findComment-33565 Share on other sites More sharing options...
arkhan 11 Posted October 13, 2017 Share Posted October 13, 2017 static Main() { wManager.Events.FightEvents.OnFightLoop += (unit, cancelable) => { if (unit.IsValid && ObjectManager.Target.IsTargetingMyPet && ObjectManager.Target.GetDistance <= 5) { wManager.Wow.Helpers.Move.Backward(Move.MoveAction.PressKey, 1500); } }; } 1)not tested, but that doesn't check if they are an obstacle behind you. 2) you could do more properly by using MovementManager.Go(PathFinder.FindPath(ObjectManager.Me.Position, new Vector3(ObjectManager.Me.Position.X, ObjectManager.Me.Position.Y + 15, ObjectManager.Me.Position.Z))); For example Marsbar and kraszus 1 1 Link to comment https://wrobot.eu/forums/topic/6443-move-back-if-add-code-in-fightclass-editor/#findComment-33567 Share on other sites More sharing options...
kraszus 5 Posted October 14, 2017 Share Posted October 14, 2017 Excellent..will try it out [EDIT] Works a treat. Thanks Arkhan :) arkhan 1 Link to comment https://wrobot.eu/forums/topic/6443-move-back-if-add-code-in-fightclass-editor/#findComment-33594 Share on other sites More sharing options...
Hekp 0 Posted March 14, 2018 Share Posted March 14, 2018 How to do after cast(any) boat began to move backward or to the side? Use fightclass editor Link to comment https://wrobot.eu/forums/topic/6443-move-back-if-add-code-in-fightclass-editor/#findComment-41301 Share on other sites More sharing options...
valetine 4 Posted March 23, 2018 Share Posted March 23, 2018 On 2017/10/14 at 3:01 AM, arkhan said: static Main() { wManager.Events.FightEvents.OnFightLoop += (unit, cancelable) => { if (unit.IsValid && ObjectManager.Target.IsTargetingMyPet && ObjectManager.Target.GetDistance <= 5) { wManager.Wow.Helpers.Move.Backward(Move.MoveAction.PressKey, 1500); } }; } 1)not tested, but that doesn't check if they are an obstacle behind you. 2) you could do more properly by using MovementManager.Go(PathFinder.FindPath(ObjectManager.Me.Position, new Vector3(ObjectManager.Me.Position.X, ObjectManager.Me.Position.Y + 15, ObjectManager.Me.Position.Z))); For example How to use this code? static Main() { wManager.Events.FightEvents.OnFightLoop += (unit, cancelable) => { if ((ObjectManager.Target.HaveBuff("Frost Nova") || ObjectManager.Target.HaveBuff("Frostbite")) && ObjectManager.Target.HealthPercent >= 10 && ObjectManager.Target.GetDistance <= 8) { MovementManager.Go(PathFinder.FindPath(ObjectManager.Me.Position, new Vector3(ObjectManager.Me.Position.X, ObjectManager.Me.Position.Y + 15, ObjectManager.Me.Position.Z))); } }; } Use like this has not work. Link to comment https://wrobot.eu/forums/topic/6443-move-back-if-add-code-in-fightclass-editor/#findComment-41595 Share on other sites More sharing options...
Ordush 185 Posted March 27, 2018 Share Posted March 27, 2018 @Droidz I thought it would be better to necro this thread, than making a new one Is there a way to check if there is any viable spots available? Instead of using backtrack I have tried using the pathfinder with var xvector = (ObjectManager.Me.Position.X) - (ObjectManager.Target.Position.X); var yvector = (ObjectManager.Me.Position.Y) - (ObjectManager.Target.Position.Y); Vector3 newpos = new Vector3() { X = ObjectManager.Me.Position.X + (float)((xvector * (25 / ObjectManager.Target.GetDistance) - xvector)), Y = ObjectManager.Me.Position.Y + (float)((yvector * (25 / ObjectManager.Target.GetDistance) - yvector)), Z = ObjectManager.Me.Position.Z }; MovementManager.Go(PathFinder.FindPath(newpos), false); Thread.Sleep(1700); This is ofc. in a loop. Now this will move my char 8-9 yards from the target walking in a straight line backwards using the pathfinder. However the issue remains the same, that if i hit a wall it will keep going. Here i can use your code written above to stop moving. Instead of this, is there a way that i can, using the pathfinder: Find a place where there is 9 yards free from the target instead? Link to comment https://wrobot.eu/forums/topic/6443-move-back-if-add-code-in-fightclass-editor/#findComment-41801 Share on other sites More sharing options...
Matenia 630 Posted March 27, 2018 Share Posted March 27, 2018 PathFinder.FindPath has an API for checking if the path it made is valid. You can also use !TraceLine.Go(vector3) to check that LoS is available to the vector from your position. Using those tools, you should be able to find a vector where no enemy is in sight (by periodicially checking LoS and enemy positions in ObjectManager) around your character. You can also use PathFinder.ReportDangerArea(vector3, radius) to tell the pathfinder to avoid this area (e.g. mob + aggro radius) while running away. But in my experience this is iffy and you should do your own "pathfinding" for small paths when not runnign very far away. Ordush 1 Link to comment https://wrobot.eu/forums/topic/6443-move-back-if-add-code-in-fightclass-editor/#findComment-41805 Share on other sites More sharing options...
Ordush 185 Posted March 27, 2018 Share Posted March 27, 2018 (edited) 12 minutes ago, Matenia said: PathFinder.FindPath has an API for checking if the path it made is valid. You can also use !TraceLine.Go(vector3) to check that LoS is available to the vector from your position. Using those tools, you should be able to find a vector where no enemy is in sight (by periodicially checking LoS and enemy positions in ObjectManager) around your character. You can also use PathFinder.ReportDangerArea(vector3, radius) to tell the pathfinder to avoid this area (e.g. mob + aggro radius) while running away. But in my experience this is iffy and you should do your own "pathfinding" for small paths when not runnign very far away. Cheers @Matenia I will try see if i can get something to work with this. :) Vector3 to, out bool resultSucess is what i'd use to see if it can go to Vector3 right? Edited March 27, 2018 by Ordush Link to comment https://wrobot.eu/forums/topic/6443-move-back-if-add-code-in-fightclass-editor/#findComment-41806 Share on other sites More sharing options...
Marsbar 228 Posted March 28, 2018 Share Posted March 28, 2018 I say you do it the LoS way with TraceLine, you wouldn't want to walk around a wall and then not be able to shoot your target right? Because the result success would give you a true if it can make a path even if that means going around a wall. Then if you don't have LoS adjust your vector either direction until you do, sort of how I explained here: https://wrobot.eu/forums/topic/7507-solved-move-after-frost-nova-is-it-really-that-hard/?do=findComment&comment=34304 THEN to make it even better check if there are hostiles where your path will go and adjust again. Maybe also add a failsafe so that if it cannot find a path, stay in melee? It's what a legitimate user would do too rather than run into other mobs. Link to comment https://wrobot.eu/forums/topic/6443-move-back-if-add-code-in-fightclass-editor/#findComment-41853 Share on other sites More sharing options...
Ordush 185 Posted March 28, 2018 Share Posted March 28, 2018 9 minutes ago, Marsbar said: I say you do it the LoS way with TraceLine, you wouldn't want to walk around a wall and then not be able to shoot your target right? Because the result success would give you a true if it can make a path even if that means going around a wall. Then if you don't have LoS adjust your vector either direction until you do, sort of how I explained here: https://wrobot.eu/forums/topic/7507-solved-move-after-frost-nova-is-it-really-that-hard/?do=findComment&comment=34304 THEN to make it even better check if there are hostiles where your path will go and adjust again. Maybe also add a failsafe so that if it cannot find a path, stay in melee? It's what a legitimate user would do too rather than run into other mobs. Mine is checking for both, so if it can't find a path, but it is in LoS then it won't try. I gave it 4 seconds to find it's way to a spot it thinks it can go to (failsafe). :) Link to comment https://wrobot.eu/forums/topic/6443-move-back-if-add-code-in-fightclass-editor/#findComment-41855 Share on other sites More sharing options...
Matenia 630 Posted March 28, 2018 Share Posted March 28, 2018 (edited) //Checks if there's available LoS between your target and the new spot too. !TraceLine.TraceLineGo(ObjectManager.Target.Position, newPos) //check if there's LoS between you and the new Pos !TraceLine.TraceLineGo(newPos) //Then you can use: bool isValid = false; var path = PathFinder.FindPath(newpos, out isValid); if(isValid) { MovementManager.Go(path, false); } This prevents a CPU/memory hog, but only using pathfinding once you confirmed LoS. Also check that no NPC is near newPos. Edited March 28, 2018 by Matenia Avvi 1 Link to comment https://wrobot.eu/forums/topic/6443-move-back-if-add-code-in-fightclass-editor/#findComment-41856 Share on other sites More sharing options...
Marsbar 228 Posted March 28, 2018 Share Posted March 28, 2018 Ah cool, didn't know the PathFinder was that heavy, performance always seems to be the last thing I think about Link to comment https://wrobot.eu/forums/topic/6443-move-back-if-add-code-in-fightclass-editor/#findComment-41857 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