Jump to content

Move to next tree in a wide area?


H0rn

Recommended Posts

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.

Link to comment
Share on other sites

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

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