Lewis Posted February 16, 2017 Share Posted February 16, 2017 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 Quote Link to comment Share on other sites More sharing options...
whipz Posted February 16, 2017 Share Posted February 16, 2017 there used to be something in an old bot walkPath(path, 4, 4) i dunno if its there still but that would randomize path by 4 wide 4 high Quote Link to comment Share on other sites More sharing options...
Lewis Posted February 16, 2017 Author Share Posted February 16, 2017 5 minutes ago, whipz said: there used to be something in an old bot walkPath(path, 4, 4) i dunno if its there still but that would randomize path by 4 wide 4 high if it was from an old bot, its almost guaranteed it isnt the same API Quote Link to comment Share on other sites More sharing options...
whipz Posted February 16, 2017 Share Posted February 16, 2017 (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 February 16, 2017 by whipz Quote Link to comment Share on other sites More sharing options...
Polymorphism Posted February 16, 2017 Share Posted February 16, 2017 (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 February 16, 2017 by Polymorphism Quote Link to comment Share on other sites More sharing options...