RegionPath Help

Discussion in 'Programming & Hardware' started by McMitch, Sep 18, 2015.

  1. So I have some code that looks like this:

    Code (Text):
    1. Coordinate playerLocation = getLocal().getPosition();
    2. System.out.println(playerLocation);
    3. System.out.println(stepArray[i]);
    4. RegionPath currentPath = build(playerLocation, stepArray[i]);
    5. System.out.println(currentPath);
    6. 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:

    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,
    --- Double Post Merged, Sep 18, 2015, Original Post Date: Sep 18, 2015 ---
    Just realised this should be in "Developer Support", could someone move it there or delete this so I can post it there?

  2. 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:, stepArray);
  3. 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.

Share This Page