Jump to content

Pathfinding without the use of pre-set paths


Psvxe

Recommended Posts

Since I'm getting pretty tired of people making pre-set paths I'd port overflow's pathfinder to OSBot.

When you have to walk a large distance you could use this code down here instead of using pre-set paths.

 

import nl.psvxe.scripts.pathfinder.core.util.Structure;
import nl.psvxe.scripts.pathfinder.core.wrapper.TilePath;
import nl.psvxe.scripts.pathfinder.impl.Pathfinder;
private Position[] currentPath;
			path = pf.findPath(Structure.TILE.getHash(ctx.myPosition().getX(), ctx.myPosition().getY(), ctx.myPosition().getZ()),Structure.TILE.getHash(x, y, z), 500, false);
			if(path == null){
				ctx.localWalker.walk(new Position(ctx.myPosition().getX()+3, ctx.myPosition().getY()+2,0));
				return;
			}
			currentPath = new Position[path.size()];
			for (int i = 0; i < path.size(); i++) {
				currentPath[i] = getTile(path.get(i).getHash());			
			}
			ctx.localWalker.walkPath(currentPath);
				
			
		
private Position getTile(int hash) {
		return new Position(Structure.TILE.getX(hash),
				Structure.TILE.getY(hash), Structure.TILE.getZ(hash));

	}
Sometimes it can get stuck if get into a new region. To fix this you've to add Dynamicsleep and return if it isn't moving.

 

if(ctx.localWalker.walkPath(currentPath)){
				new DynamicSleep(int0, int1){

					@Override
					public boolean breakCondition() {
						return !ctx.myPlayer().isMoving();
					}
					
				}.sleep();
			}
Download the jar and import it into your libary: https://www.dropbox.com/s/lskdq1s4hiykyec/Pathfinder.jar?dl=0

 

 

 

 

Thanks overflow for the code! https://github.com/Overflow-p****bot/Pathfinder

Thanks Erke for helping me out with a few things smile.png

To make the paths more randomized you could add this within the code too: http://osbot.org/forum/topic/71632-getrandomizedpathposition-int-getlocalpathposition-position/

Edited by Psvxe
Link to comment
Share on other sites

What is this, a fancy LocalWalker? It looks somewhat redundant with an already existing walker within the local region and webwalkers doing the rest :x

So, is there a webwalker out for public? And I don't see how you can travel from lumbridge to ardougne without the use of a pre-set path and the use of the current local walker.

But if you could explain, it would be nice.

Link to comment
Share on other sites

So, is there a webwalker out for public? And I don't see how you can travel from lumbridge to ardougne without the use of a pre-set path and the use of the current local walker.

But if you could explain, it would be nice.

No there's not, is that what you've achieved? You can't get paths taking you outside the current loaded region without a webwalker :x

 

Honestly, it is easier than it seems once you grasp the concept of it, hardest tasking being the pathfinding algorithm and gathering the actual data. More time-consuming than difficult tbh.

Link to comment
Share on other sites

sounds promising tongue.png 

Not that i am that advanced yet tho XD

It really isn't. If you need help just hit me up trough pm smile.png

No there's not, is that what you've achieved? You can't get paths taking you outside the current loaded region without a webwalker :x

 

Honestly, it is easier than it seems once you grasp the concept of it, hardest tasking being the pathfinding algorithm and gathering the actual data. More time-consuming than difficult tbh.

I'm trying to make a webwalker. Actually, I got most of the data. Even thinking of releasing that. Perhaps something far more advanced could be created for public to use. So we don't get banned because we use 10 different kinds of walking.

Anyways, https://www.youtube.com/watch?v=KUAwauxufCM

Few small flaws but it corrects itself. Loads and walks trough 2 regions.

Link to comment
Share on other sites

It really isn't. If you need help just hit me up trough pm smile.png

I'm trying to make a webwalker. Actually, I got most of the data. Even thinking of releasing that. Perhaps something far more advanced could be created for public to use. So we don't get banned because we use 10 different kinds of walking.

Anyways, https://www.youtube.com/watch?v=KUAwauxufCM

Few small flaws but it corrects itself. Loads and walks trough 2 regions.

I dont think thats how bans work buddy. :o
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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