Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[SOLVED] Move after Frost Nova - is it really that hard?

Featured Replies

This took me a while, I had the help of my GF who did mathy things in school (unlike me) to be my human calculator;

	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 * (20 / ObjectManager.Target.GetDistance)-xvector)),
            Y = ObjectManager.Me.Position.Y + (float)((yvector * (20 / ObjectManager.Target.GetDistance)-yvector)),
            Z = ObjectManager.Me.Position.Z
        };
        MovementManager.Go(PathFinder.FindPath(newpos), false);

Currently this runs ~20 yards back away from the target using the pathfinder, you can change the 20 to be what you want and also add it to the onfightloop with an if condition. Let me know how it goes!

  • Replies 60
  • Views 14.9k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • Try adding  FightEvents.OnFightLoop += (unit, cancelable) => { if (ObjectManager.Target.GetDistance < 8) { var xvector = (ObjectManag

  • You actually need to set isTooClose to false again after the while loop and maybe give it a short Thread.Sleep(500) or so at the end of each iteration. Does the bot interrupt movement and then start

  • Not sure if you have seen this post -> move back if... add code in fightclass editor

  • Author
1 hour ago, Marsbar said:

This took me a while, I had the help of my GF who did mathy things in school (unlike me) to be my human calculator;


	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 * (20 / ObjectManager.Target.GetDistance)-xvector)),
            Y = ObjectManager.Me.Position.Y + (float)((yvector * (20 / ObjectManager.Target.GetDistance)-yvector)),
            Z = ObjectManager.Me.Position.Z
        };
        MovementManager.Go(PathFinder.FindPath(newpos), false);

Currently this runs ~20 yards back away from the target using the pathfinder, you can change the 20 to be what you want and also add it to the onfightloop with an if condition. Let me know how it goes!

Wow man, thanks for taking the time! And thanks to your girlfriend!

It does what it's supposed to... but... bad news... still the same stuttering issue. :(

 

Here is how I tested:

  1. made a blank Fightclass with only Frost Nova and your move. Tries to move but stutters = does not even move the full 20 yards.
    Spoiler
    
    using System;
    using System.Linq;
    using System.Threading;
    using System.Windows.Forms;
    using robotManager.Helpful;
    using robotManager.Products;
    using wManager.Wow.Class;
    using wManager.Wow.Enums;
    using wManager.Events;
    using wManager.Wow.Helpers;
    using wManager.Wow.ObjectManager;
    using System.Configuration;
    using System.ComponentModel;
    using System.IO;
    using robotManager;
    using System.Collections.Generic;
    using Timer = robotManager.Helpful.Timer;
    
    public class Main : ICustomClass
    {
        public float Range { get { return 29f; } }
        private bool iMageLaunched;
    
        public void Initialize() // When product started, initialize and launch Fightclass
        {
            iMageLaunched = true;
            Logging.Write("iMage initialized.");
            Start();
        }
    
        public void Dispose() // When product stopped
        {
            iMageLaunched = false;
            Logging.Write("iMage stopped.");
        }
    
        public void ShowConfiguration() // When use click on Fight class settings
        {
            iMageSettings.Load();
            iMageSettings.CurrentSetting.ToForm();
            iMageSettings.CurrentSetting.Save();
        }
    	
        // SPELLS:
        public Spell FrostBolt = new Spell("Frostbolt");
    
    
        private void CombatRotation()
    	{
    		if (ObjectManager.Target.GetDistance <= 6 && !ObjectManager.Target.HaveBuff("Frost Nova") && !ObjectManager.Target.HaveBuff("Frostbite") && ObjectManager.Target.HealthPercent >= 25) // && ObjectManager.Target.GetDistance >= 6 
    		{
    			SpellManager.CastSpellByNameLUA("Frost Nova");
    			return;
    		}
    		else if ((ObjectManager.Target.HaveBuff("Frost Nova") || ObjectManager.Target.HaveBuff("Frostbite")) && ObjectManager.Target.GetDistance <= 6)
    		{
    			while (ObjectManager.Target.GetDistance <= 6)
    			{
    				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 * (20 / ObjectManager.Target.GetDistance)-xvector)),
    					Y = ObjectManager.Me.Position.Y + (float)((yvector * (20 / ObjectManager.Target.GetDistance)-yvector)),
    					Z = ObjectManager.Me.Position.Z
    				};
    				MovementManager.Go(PathFinder.FindPath(newpos), false);
    			}
    			return;
    		}
    	}
    
        public void Start()
        {
            
            Logging.Write("iMage Loaded");
            while (iMageLaunched)
            {
                if (!Products.InPause)
                    {
                        if (!ObjectManager.Me.IsDeadMe)
                        {
                            if (Fight.InFight && ObjectManager.Me.Target > 0)
                            {
                                CombatRotation();
                            }
                        }
                    }
                Thread.Sleep(50);
            }
            Logging.Write("iMage is now stopped.");
        }
    
        [Serializable]
        public class iMageSettings : Settings
        {
            public iMageSettings()
            {
                ConfigWinForm(new System.Drawing.Point(400, 400), "iMage" + Translate.Get("Settings"));
            }
    
            public static iMageSettings CurrentSetting { get; set; }
    
            public bool Save()
            {
                try
                {
                    return Save(AdviserFilePathAndName("iMage-Mage", ObjectManager.Me.Name + "." + Usefuls.RealmName));
                }
                catch (Exception e)
                {
                    Logging.WriteError("iMageSettings > Save(): " + e);
                    return false;
                }
            }
    
            public static bool Load()
            {
                try
                {
                    if (File.Exists(AdviserFilePathAndName("iMage-Mage", ObjectManager.Me.Name + "." + Usefuls.RealmName)))
                    {
                        CurrentSetting =
                            Load<iMageSettings>(AdviserFilePathAndName("iMage-Mage",
                                                                        ObjectManager.Me.Name + "." + Usefuls.RealmName));
                        return true;
                    }
                    CurrentSetting = new iMageSettings();
                }
                catch (Exception e)
                {
                    Logging.WriteError("iMageSettings > Load(): " + e);
                }
                return false;
            }
        }
    }

     

     

  2. I tried adding the MoveEvents but with those, the bot doesn't move at all.

  3. Also tried making a Fightclass with movement only so I can record and show it you all. Here's the code:

    Spoiler
    
    using System;
    using System.Linq;
    using System.Threading;
    using System.Windows.Forms;
    using robotManager.Helpful;
    using robotManager.Products;
    using wManager.Wow.Class;
    using wManager.Wow.Enums;
    using wManager.Events;
    using wManager.Wow.Helpers;
    using wManager.Wow.ObjectManager;
    using System.Configuration;
    using System.ComponentModel;
    using System.IO;
    using robotManager;
    using System.Collections.Generic;
    using Timer = robotManager.Helpful.Timer;
    
    public class Main : ICustomClass
    {
        public float Range { get { return 29f; } }
        private bool iMageLaunched;
    
        public void Initialize() // When product started, initialize and launch Fightclass
        {
            iMageLaunched = true;
            Logging.Write("iMage initialized.");
            Start();
        }
    
        public void Dispose() // When product stopped
        {
            iMageLaunched = false;
            Logging.Write("iMage stopped.");
        }
    
        public void ShowConfiguration() // When use click on Fight class settings
        {
            iMageSettings.Load();
            iMageSettings.CurrentSetting.ToForm();
            iMageSettings.CurrentSetting.Save();
        }
    	
        // SPELLS:
        public Spell FrostBolt = new Spell("Frostbolt");
    
    
        private void CombatRotation()
    	{
    		if (ObjectManager.Target.GetDistance <= 6)
    		{
    			while (ObjectManager.Target.GetDistance <= 20)
    			{
    				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 * (20 / ObjectManager.Target.GetDistance)-xvector)),
    					Y = ObjectManager.Me.Position.Y + (float)((yvector * (20 / ObjectManager.Target.GetDistance)-yvector)),
    					Z = ObjectManager.Me.Position.Z
    				};
    				MovementManager.Go(PathFinder.FindPath(newpos), false);
    			}
    			return;
    		}
    	}
    
        public void Start()
        {
            
            Logging.Write("iMage Loaded");
            while (iMageLaunched)
            {
                if (!Products.InPause)
                    {
                        if (!ObjectManager.Me.IsDeadMe)
                        {
                            if (Fight.InFight && ObjectManager.Me.Target > 0)
                            {
                                CombatRotation();
                            }
                        }
                    }
                Thread.Sleep(50);
            }
            Logging.Write("iMage is now stopped.");
        }
    
        [Serializable]
        public class iMageSettings : Settings
        {
            public iMageSettings()
            {
                ConfigWinForm(new System.Drawing.Point(400, 400), "iMage" + Translate.Get("Settings"));
            }
    
            public static iMageSettings CurrentSetting { get; set; }
    
            public bool Save()
            {
                try
                {
                    return Save(AdviserFilePathAndName("iMage-Mage", ObjectManager.Me.Name + "." + Usefuls.RealmName));
                }
                catch (Exception e)
                {
                    Logging.WriteError("iMageSettings > Save(): " + e);
                    return false;
                }
            }
    
            public static bool Load()
            {
                try
                {
                    if (File.Exists(AdviserFilePathAndName("iMage-Mage", ObjectManager.Me.Name + "." + Usefuls.RealmName)))
                    {
                        CurrentSetting =
                            Load<iMageSettings>(AdviserFilePathAndName("iMage-Mage",
                                                                        ObjectManager.Me.Name + "." + Usefuls.RealmName));
                        return true;
                    }
                    CurrentSetting = new iMageSettings();
                }
                catch (Exception e)
                {
                    Logging.WriteError("iMageSettings > Load(): " + e);
                }
                return false;
            }
        }
    }

     

     

Here's the video of above code in action: https://www.youtube.com/watch?v=B9ANAEQ0rSg

 

I googled a bit and found an example where a while loop with sleep is used until the movement stops. I thought that makes sense so I tried and logged the loops to see what's going on.

			while (ObjectManager.Target.GetDistance <= 20)
			{
				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 * (20 / ObjectManager.Target.GetDistance)-xvector)),
					Y = ObjectManager.Me.Position.Y + (float)((yvector * (20 / ObjectManager.Target.GetDistance)-yvector)),
					Z = ObjectManager.Me.Position.Z
				};
				MovementManager.Go(PathFinder.FindPath(newpos), false);
				Logging.Write("STARTED MOVING");
				while (MovementManager.InMovement && Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause)
				{
					Thread.Sleep(1000);
					Logging.Write("STILL MOVING");
				}
			}

Didn't have any effect at all. Here is the result from the log. It looks like how I though it would look. It doesn't perform the move, it performs dozens of small little tiny moves for some reason, hence the stuttering.

Quote

22:26:49 - STARTED MOVING
22:26:50 - STILL MOVING
22:26:50 - STARTED MOVING
22:26:51 - STILL MOVING
22:26:51 - STARTED MOVING
22:26:52 - STILL MOVING
22:26:52 - STARTED MOVING
22:26:53 - STILL MOVING
22:26:53 - STARTED MOVING
22:26:54 - STILL MOVING
22:26:54 - STARTED MOVING
22:26:55 - STILL MOVING
22:26:56 - STARTED MOVING
22:26:57 - STILL MOVING
22:26:57 - STARTED MOVING
22:26:58 - STILL MOVING
22:26:58 - STARTED MOVING

 

Can you try targetting something (can be a friendly), running wrotation and running my code in the dev tools?

Edit: I'm also in vanilla and it works running in dev tools, havent tried it in a fight class yet

  • Author
11 minutes ago, Marsbar said:

Can you try targetting something (can be a friendly), running wrotation and running my code in the dev tools?

Edit: I'm also in vanilla and it works running in dev tools, havent tried it in a fight class yet

I don't know how to do that. However I tried with a custom profile and it worked nicely. But, keep in mind that simple wManager.Wow.Helpers.Move.StrafeLeft(Move.MoveAction.PressKey, 1000); also worked with a custom profile but got messed up once it was inside a Fightclass and my toon was in combat.

EDIT: But since you mentioned it, how do you run code from within the dev tools? You just put it in and start WRotation? If so, that did nothing.

You can run any c# code in the dev tools;

Tools>Development Tools>Paste your code in the window>Press c# button.

I'll try adding it to a fight class and see if i get better results.

  • Author
3 minutes ago, Marsbar said:

You can run any c# code in the dev tools;

Tools>Development Tools>Paste your code in the window>Press c# button.

I'll try adding it to a fight class and see if i get better results.

Yup that worked fine just like the custom profile.

Try adding 

FightEvents.OnFightLoop += (unit, cancelable) => {
            if (ObjectManager.Target.GetDistance < 8)
            {
                
                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 * (20 / ObjectManager.Target.GetDistance) - xvector)),
                    Y = ObjectManager.Me.Position.Y + (float)((yvector * (20 / ObjectManager.Target.GetDistance) - yvector)),
                    Z = ObjectManager.Me.Position.Z
                };
                MovementManager.Go(PathFinder.FindPath(newpos), false);
                Thread.Sleep(1500);
            }
        };    

edit: the thread.sleep is a bit of a workaround to stop whatever else is interfering

you may also want to increase that if distance to higher than 8

  • Author
19 minutes ago, Marsbar said:

Try adding 


FightEvents.OnFightLoop += (unit, cancelable) => {
            if (ObjectManager.Target.GetDistance < 8)
            {
                
                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 * (20 / ObjectManager.Target.GetDistance) - xvector)),
                    Y = ObjectManager.Me.Position.Y + (float)((yvector * (20 / ObjectManager.Target.GetDistance) - yvector)),
                    Z = ObjectManager.Me.Position.Z
                };
                MovementManager.Go(PathFinder.FindPath(newpos), false);
                Thread.Sleep(1500);
            }
        };    

 

GG WP! Yup that's it. Works both in my test blank fightclass as well as in the main one!

Thank you very much @Marsbar.

Also thank you @Matenia and @Apexx ! I apreciate the help guys!

This will definitely help me with my rogue fightclass as well. The only thing missing from perfection is moving to a spot without mobs. But that is way above my knowledge of coding :-D

 

23 minutes ago, Apexx said:

Not sure if you have seen this post -> move back if... add code in fightclass editor

You know what the funny part is? I've seen that post dozens of times when I was googling but since I didn't know what FightEvents.OnFightLoop was or even how to use it properly I didn't even attempted to fiddle with it. I was so close yet so far :-D

  • Author

Just so I understand and correct me if I'm wrong, but this basically overrides the default Fight behavior? It "cancels" the current Fight behavior, inserts a new one (our code), and once that inserted "event" is resolved it continues with the BAU Fight behavior. Is that correct?

9 hours ago, Seminko said:

Just so I understand and correct me if I'm wrong, but this basically overrides the default Fight behavior? It "cancels" the current Fight behavior, inserts a new one (our code), and once that inserted "event" is resolved it continues with the BAU Fight behavior. Is that correct?

No, that's why you were getting the stuttering. It was trying to go back to doing what it was and then hitting the condition again (i think). We're adding extra behavior to the onfightloop.

In regards to moving to a "safe" position, it may not be as hard as we think. We need to change the direction of the vector if a mob is too close to the end position.

If you look at the code you can see that the xvector and yvector are our position xy minus the target xy. This ends up giving us the x and y distance we move in the x and y directions.

Example (ignoring z axis):

Our target is at position x:55,y:45

We are at position x:48,y:44

Our x position minus the target x position = our x vector == 48 - 55 = -7

Our y position minus the target y position = our y vector == 44 - 45 = -1

EHTGG15.png

What we could do is then add or subtract to that vector if an enemy is too close to our target pos, which would change the direction from the Me pos. 

(I'm at work again so cant play with it but it's actually quite interesting because I'm starting to get how this works lol)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.