1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

RegionPath Help

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

  1. McMitch

    Joined:
    Sep 11, 2015
    Messages:
    3
    Likes Received:
    0
    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:
    [​IMG]

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

    Thanks
     
  2. chumbex

    Joined:
    Nov 7, 2015
    Messages:
    5
    Likes Received:
    1
    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);
     
  3. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    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

Loading...