January 8, 201610 yr How can I make the player walk to a random tile inside an area? I've used walking event and webwalk but both seem to randomly every now and again walk 1-2 tiles away from the area. By the way I have put the min distance threshold on walking event to 0 but it doesn't seem to work as intended on the API so possibly a client bug. Thanks Edited January 8, 201610 yr by steve498
January 8, 201610 yr How can I make the player walk to a random tile inside an area? I've used walking event and webwalk but both seem to randomly every now and again walk 1-2 tiles away from the area. By the way I have put the min distance threshold on walking event to 0 but it doesn't seem to work as intended on the API so possibly a client bug. Thanks walking.walk(area.getRandomPosition()); or walking.webWalk(area.getRandomPosition()); ? Edited January 8, 201610 yr by Explv
January 8, 201610 yr Author walking.walk(area.getRandomPosition()); or walking.webWalk(area.getRandomPosition()); ? I have tried these and no luck. Basically this is how I'm testing it: I have an area created and a condition that checks whether the area contains the player. If true, great! if false, then log it. Sooo... I then use the methods you mentioned and sometimes it will say that I'm not inside the area. So it is not walking in one of the area's tiles. Hopefully that makes some sense.
January 8, 201610 yr I have tried these and no luck. Basically this is how I'm testing it: I have an area created and a condition that checks whether the area contains the player. If true, great! if false, then log it. Sooo... I then use the methods you mentioned and sometimes it will say that I'm not inside the area. So it is not walking in one of the area's tiles. Hopefully that makes some sense. You should use WakingEvent, however I feel like the min threshold stuff might not be working right now. You could try: MainScreenTileDestination destination = new MainScreenTileDestination(getBot(), area.getRandomPosition()); getMouse().click(destination); or: MiniMapTileDestination destination = new MiniMapTileDestination(getBot(), area.getRandomPosition()); getMouse().click(destination); Edited January 8, 201610 yr by Explv
January 8, 201610 yr I have tried these and no luck. Basically this is how I'm testing it: I have an area created and a condition that checks whether the area contains the player. If true, great! if false, then log it. Sooo... I then use the methods you mentioned and sometimes it will say that I'm not inside the area. So it is not walking in one of the area's tiles. Hopefully that makes some sense. if(AREA.contain(player)){ walker.walk(AREA.getRandomPosition()); } else { log("Area does not contain player"); } Edited January 8, 201610 yr by ni562
January 8, 201610 yr Author You should use WakingEvent, however I feel like the min threshold stuff might not be working right now. You could try: MainScreenTileDestination destination = new MainScreenTileDestination(getBot(), area.getRandomPosition()); getMouse().click(destination); Tried and just spams this in the console... This message is logged when the area does not contain the player. When it does not contain the player it executes the code to walk to the area. Unfortunately nothing happens with the solution you just provided Edit: Trying other solutions just posted bare with... Thanks Edited January 8, 201610 yr by steve498
January 8, 201610 yr if(AREA.contain(player)){ walker.walk(AREA.getRandomPosition()); } else { stop(); } That is incorrect, and also he said walker.walk doesn't work
January 8, 201610 yr Author That is incorrect, and also he said walker.walk doesn't work Well it does but it puts me 1-2 tiles away sometimes. Also that code wouldn't work as it would try to move the player when they are already inside the area? Will edit this post after testing your second solution Explv, thanks. Update: Well the second solution looks like it worked however, inside the bank it cannot run back to the area because it is not on the minimap. Edited January 8, 201610 yr by steve498
January 8, 201610 yr That is incorrect, and also he said walker.walk doesn't work Except an 's' what did i miss?
January 8, 201610 yr Except an 's' what did i miss? it only walks to a random position in the area, if it's already in the area Well it does but it puts me 1-2 tiles away sometimes. That is because the walker uses default WalkingEvent which walks with a minthreshold of 2 tiles. You should either wait for WalkingEvent to be fixed (if its broken) or just walk to a position deep in the area rather than a random one? Edited January 8, 201610 yr by Explv
January 8, 201610 yr Author it only walks to a random position in the area, if it's already in the area That is because the walker uses default WalkingEvent which walks with a minthreshold of 2 tiles. You should either wait for WalkingEvent to be fixed (if its broken) or just walk to a position deep in the area? I thought by setting the minDistance threshold to 0 it would override this but I could be wrong and yes that is what I was just considering. I think I'll stick to WalkingEvent and just make a path and place it inside an area deep so if it's 1-2 tiles out it'll still be in the area. Thanks anyway I appreciate it
January 8, 201610 yr Position pos = Area.getRandomPosition(); long safeGuard = System.currentTimeMillis(); while(!Area.contains(pos)) { pos = Area.getRandomPosition(); if(System.currentTimeMillis() - safeGuard > 1000) { log("Something went wrong -_-"); break; } } You could try something like that. Edited January 8, 201610 yr by dopenes
January 9, 201610 yr Position pos = Area.getRandomPosition(); long safeGuard = System.currentTimeMillis(); while(!Area.contains(pos)) { pos = Area.getRandomPosition(); if(System.currentTimeMillis() - safeGuard > 1000) { log("Something went wrong -_-"); break; } } You could try something like that. This code wont make any difference. Considering his walking code will be inside the onLoop method, the same functionality will occur. The issue lies somewhere else, probably with the walker stopping outside the area due to its minThreshold setting.
January 9, 201610 yr This code wont make any difference. Considering his walking code will be inside the onLoop method, the same functionality will occur. The issue lies somewhere else, probably with the walker stopping outside the area due to its minThreshold setting. Ehh, I was assuming that the getRandomPosition() method was returning a position OUTSIDE of the area. If this is the case, then this will fix it, but if not, then yeah, lol.
Create an account or sign in to comment