Jump to content

Move to next tree in a wide area?


Recommended Posts

Posted

Hey, so I was planning on making a farm purely based on my own knowledge but I have come across an issue that no matter what I try there's always issues, here's my method for checking for trees:

 

RS2Object Yew = objects.closest(yew -> yew.exists() && yew.getName().equals("Yew") && yews.contains(yew));

 

But for some reason when it cuts down one tree it just hangs there until it re-spawns and doesn't try to go to the next nearest tree, here's my yew Area also:

 

Area yews = new Area(
    	    new int[][]{
    	        { 3266, 3472 },
    	        { 3272, 3464 },
    	        { 3307, 3461 },
    	        { 3313, 3468 },
    	        { 3309, 3474 },
    	        { 3271, 3484 },
    	        { 3270, 3496 },
    	        { 3264, 3498 }
    	    }
    	);

 

any tips in the right direction would be appreciated.

Posted
2 minutes ago, H0rn said:

Hey, so I was planning on making a farm purely based on my own knowledge but I have come across an issue that no matter what I try there's always issues, here's my method for checking for trees:

 


RS2Object Yew = objects.closest(yew -> yew.exists() && yew.getName().equals("Yew") && yews.contains(yew));

But for some reason when it cuts down one tree it just hangs there until it re-spawns and doesn't try to go to the next nearest tree, here's my yew Area also:

any tips in the right direction would be appreciated.

 

Looking at your Area:

669d3f9b9cd6a34c3f2fb5bf6648bc16.png

 

It seems like the different Yew tree spawns are pretty far apart from each other.

You *may* need to add your own code to say, "if there are no yew trees in my current spawn, walk to another yew tree spawn".

That is assuming that there are no other issues with your code, which I cannot tell as you have only posted a small snippet.

  • Like 1
Posted (edited)
3 minutes ago, Explv said:

 

Looking at your Area:

669d3f9b9cd6a34c3f2fb5bf6648bc16.png

 

It seems like the different Yew tree spawns are pretty far apart from each other.

You *may* need to add your own code to say, "if there are no yew trees in my current spawn, walk to another yew tree spawn".

That is assuming that there are no other issues with your code, which I cannot tell as you have only posted a small snippet.

 

I tried to keep it as simple as possible but do you recommend using more than one area?

 

I also tried this:

if (Yew.getPosition().distance(myPlayer()) > 5) {
                    currentStatus = "Walking closer";
                    walking.walk(Yew.getArea(1));
                }

but it isn't very reliable and still hangs at the stump most of the time :(

 

 

Edit: here's the full snippet:

 

private void cutYews() throws InterruptedException {
		currentStatus = "Yews";
		if (!yews.contains(myPlayer())) {
			currentStatus = "Walking to Yews";
			walking.webWalk(yews);
			Sleep.sleepUntil(() -> yews.contains(myPlayer()),random(1200,3000));
		}
		else {
			currentStatus = "Cutting Yews";
			RS2Object Yew = objects.closest(yew -> yew.exists() && yew.getName().equals("Yew") && yews.contains(yew));
			if (Yew != null && !myPlayer().isAnimating() && !myPlayer().isMoving()) {
				if (Yew.getPosition().distance(myPlayer()) > 5) {
					currentStatus = "Walking closer";
					walking.walk(Yew.getArea(1));
				}
				if (!Yew.isVisible()) {
					currentStatus = "Moving the camera";
					camera.toEntity(Yew);
				}
				currentStatus = "Chop down";
				Yew.interact("Chop down");
				Sleep.sleepUntil(() -> !Yew.exists() || myPlayer().isMoving() || myPlayer().isAnimating(), random(2600,3000));
				mouse.moveOutsideScreen();
			}
		}
    }

 

Edited by H0rn

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...