Jump to content

Custom Obstacle Handing?


Recommended Posts

Posted

Alright so basically I have each of the mining areas in the motherlode mined defined. I want to be able to walk to one of these areas and handle the rockfall obstacles that are in the way. Right now if a rockfall is present, a path is not able to be generated. If the rockfall is already mined, the path works fine. Im trying to figure out a way to "ignore" obstacles and generate a path so that I can handle the rockfalls myself (when it gets stuck infront of it using the path). 

 

Is there a different approach to doing this?

Posted (edited)

The LocalPathfinder has an overload that takes a clipping graph for path generation. Just get the current clipping graph and set the rock positions to be traversible, and use that with the pathfinder. Then add whatever handling you want.

 

OR do as the others said and make your own pathfinder.

Edited by FrostBug
Posted

The LocalPathfinder has an overload that takes a clipping graph for path generation. Just get the current clipping graph and set the rock positions to be traversible, and use that with the pathfinder. Then add whatever handling you want.

 

OR do as the others said and make your own pathfinder.

 

Okay so I came up with this. Now it will try and walk. How do I go about handling the rockfall when its in front of the player?

if(!inZone()){
		LocalPathFinder path = new LocalPathFinder(getBot());
		LinkedList<Position> generatedPath = path.findPath(getRandomZone().zone.getRandomPosition(), generateModifiedClippingData());
		getLocalWalker().walking.walkPath(generatedPath);

	}

In getting the clipping data I also get a List<RS2Object> of all the rockfalls. Should I just iterate through that list and "mine" the closest one? Is there a better way of doing this?

Posted (edited)

Okay so I came up with this. Now it will try and walk. How do I go about handling the rockfall when its in front of the player?

if(!inZone()){
		LocalPathFinder path = new LocalPathFinder(getBot());
		LinkedList<Position> generatedPath = path.findPath(getRandomZone().zone.getRandomPosition(), generateModifiedClippingData());
		getLocalWalker().walking.walkPath(generatedPath);

	}

In getting the clipping data I also get a List<RS2Object> of all the rockfalls. Should I just iterate through that list and "mine" the closest one? Is there a better way of doing this?

 

Get the rockfalls located on the generated path. With this you can walk to the tile in front of the next rockfall, mine it, continue.

Edited by FrostBug

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...