Jump to content

How do I use Pathfinder.Findpath?


johnblaster123

Recommended Posts

Hello,

So i made a plugin that trains herb and skinning it works, but when my bot is for example in elwyn forest he wants to go to stormwind in straight line through the mountains..

he wants to use this code:

wManager.Wow.Bot.Tasks.GoToTask.ToPositionAndIntecractWithNpc(new Vector3(-8969.99f, 779.636f, 95.89193f), 5566, 1, false);

So I tried code below, but its not working he keeps trying to go in straight line to sw.. help me out how do I use the pathfinder?

                var position = new Vector3(-8969.99f, 779.636f, 95.89193f);
                int npcEntryId = 6929; 

                Logging.Write("bindloc: " + bindLocation);
                //while (bindLocation != "Stormwind")
                //Logging.Write(ObjectManager.Me.Position.ToString());
                var lo = PathFinder.FindPath(ObjectManager.Me.Position, position);
                Logging.Write(lo.ToString());
                foreach (Vector3 waypoint in lo)
                {
                    Logging.Write(waypoint.ToString());
                    // Move to the given position
                    MovementManager.Go(PathFinder.FindPath(waypoint), false);

                    // Loop
                    while (MovementManager.InMovement && Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause)
                    {
                        ObjectManager.Me.Position.DistanceTo2D(waypoint) > 1.5
                        // Wait follow path
                        Thread.Sleep(10);
                    }
                }
Link to comment
Share on other sites

  • 2 weeks later...

Hello, it is more like that:

        var position = new Vector3(-8969.99f, 779.636f, 95.89193f);
        int npcEntryId = 6929;

        Logging.Write("bindloc: " + bindLocation);
        //while (bindLocation != "Stormwind")
        //Logging.Write(ObjectManager.Me.Position.ToString());
        var lo = PathFinder.FindPath(ObjectManager.Me.Position, position);
        Logging.Write(lo.ToString());
        MovementManager.Go(lo);
        // Loop
        while (MovementManager.InMovement && Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause)
        {
            Thread.Sleep(10);
        }
        MovementManager.StopMove();

 

Link to comment
Share on other sites

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