iJodix Posted February 29, 2016 Share Posted February 29, 2016 (edited) Alright, so for some odd reason the following code takes literally around 2-4 seconds to generate a random position; Any ideas ? getWalking().walk(npc.getArea(3).getRandomPosition()); Full code; @Override public int onLoop() throws InterruptedException { NPC npc = getNpcs().closest(n -> n.getName().equals("Twat") && n.hasAction("Attack") && n.getHealthPercent() > 0); if (npc != null) { if (npc.getPosition().distance(myPosition()) <= 3) { } else { getWalking().walk(npc.getArea(3).getRandomPosition()); } } return 0; } Edited February 29, 2016 by iJodix Quote Link to comment Share on other sites More sharing options...
Basic Herbs Posted March 1, 2016 Share Posted March 1, 2016 You could write your own randomized function based on the Positions contained in the area. Whenever I use randomization, I try to use some sort of normal distribution since real human interaction wouldn't randomly choose any location in an area of tiles. Most of the endpoints would be centered on the exact npc location. This is the same for any mouse clicks, and wait times between actions. It's a bit of work to code it, but well worth it to prevent botting-like features. Try looking into Java's Random class, specifically their nextGaussian() function, as well as Gaussian (normal) distribution. Quote Link to comment Share on other sites More sharing options...
Goaks Posted March 2, 2016 Share Posted March 2, 2016 its not because if its moving every time it re loops its recalculating? Quote Link to comment Share on other sites More sharing options...