Jump to content

Over 9 years


iJodix

Recommended Posts

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

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.

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