Jump to content

how to walk a random path to destination?


Lewis

Recommended Posts

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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