Jump to content

how to walk a random path to destination?


Recommended Posts

Posted

looking to stop using the webwalker and use paths, but i want to randomize the path the script will take.
i can for example make it:

walk to DESTINEDAREA using: path1 or path2 or path3 or path 4 etc

but it seems very inefficient to have 10 paths for the 1 actual path i want to walk.
is there a way i can randomize the tiles it walks on a path within a range of the original set tiles

Posted (edited)
4 minutes ago, Lewis said:

if it was from an old bot, its almost guaranteed it isnt the same API

thats the best I have at the moment ): Sorry mate Ill have a look in morning its a tad late here ):

4 minutes ago, Lewis said:

if it was from an old bot, its almost guaranteed it isnt the same API

thats the best I have at the moment ): Sorry mate Ill have a look in morning its a tad late here ):

 

edit

This might help

WalkingEvent()
Creates a walking event for which a path will need to be set with the setPath() methods.
WalkingEvent(Area area)
Creates a walking event with a minDistanceThreshold of 2 and a miniMapDistanceThreshold of 5 to a random location within the given area.
WalkingEvent(Entity entity)
Creates a walking event with a minDistanceThreshold of 2 and a miniMapDistanceThreshold of 5 to the location of the given entity.
WalkingEvent(Position position)
Creates a walking event with a minDistanceThreshold of 2 and a miniMapDistanceThreshold of 5 to the location of the given position.
Edited by whipz
Posted (edited)

For completely random paths for each run, just have a few hardcoded and chose which one randomly. This below will take a path and randomize the actual tile it's walked to by an offset. It's not tested, nor probably the way to do things. 

 


//add inside the for loop camera controlls
//also helps to check the distance, if so far then use the minimap
//also if distance of position is so close (ie distance=4) skip to next position
public void walkRandom(Position... pos, int minX, int maxX, int minY, int maxY){
	
	Position tmpPos = null;
	for(Position p : pos) {
		int xrand = p.getX() + random(minX, maxX); //min,max are offsets of the position
		int yrand = p.getY() + random(minY, maxY); //Can use negative integer
		tmpPos = new Position(xrand, yrand, p.getZ());
		//if canReach tmpPos
		//walk to tmpPos		
	}


}

 

Edited by Polymorphism

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