Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

RegionPath Help

Joined
Sep 11, 2015
Messages
3
So I have some code that looks like this:

Code:
Coordinate playerLocation = getLocal().getPosition();
System.out.println(playerLocation);
System.out.println(stepArray[i]);
RegionPath currentPath = build(playerLocation, stepArray[i]);
System.out.println(currentPath);
currentPath.step();
(stepArray is just an array of Coordinates)

The problem is the RegionPath comes back null...

This is the console printout after the bot crashes:
338381696e.png


From Eagles13's video I remember that a RegionPath can only be built in a circle around the player of 104, but that should be okay for those coordinates. I think I am misunderstanding something fundamental about Regions.

Any help would be greatly appreciated,
Thanks
 
Just realised this should be in "Developer Support", could someone move it there or delete this so I can post it there?

Thanks
 
Joined
Nov 7, 2015
Messages
5
If you wish to create a path between the player and another object or coordinate, you can use RegionPath.buildTo(stepArray) cause it already uses the player as the origin. Or if you want to use the RegionPath.built(), the first parameter needs to be an entity and not a coordinate, resulting in this: RegionPath.build(Players.getLocal(), stepArray);
 
Joined
Dec 10, 2014
Messages
3,255
If you wish to create a path between the player and another object or coordinate, you can use RegionPath.buildTo(stepArray) cause it already uses the player as the origin. Or if you want to use the RegionPath.built(), the first parameter needs to be an entity and not a coordinate, resulting in this: RegionPath.build(Players.getLocal(), stepArray);
Btw, build(Locatable, Locatable...) takes a single Locatable, followed by a varargs of Locatables as parameters, so you can indeed use a Coordinate.
The first parameter specifies the origin, the varargs specifies possible destinations.
Also the loaded region isn't always based around your player, and it's width and height are 104 and 104, meaning that if it were centered around your player, you'd have 52 tiles north and west before you hit the edge. The edge of the loaded region can even be less than 15 coordinates away in some cases.
 
Top