Jump to content

WalkingEvent not working 90% of time


Recommended Posts

Posted (edited)

Hello World!

I've run into a problem with my script not executing the walkingevent properly.

 

Position rcarea = new Position(2701, 3719, 0);
Area rcarea1 = new Area(2702, 3719, 2701, 3719);
Area reset = new Area(2705, 3687, 2699, 3689);
WalkingEvent walk = new WalkingEvent(rcarea);

onLoop
if (timer >= 250) {
getWalking().walk(reset);
camera.moveYaw(random(0, 360));
timer = 0L;
status = "Reset aggro";

		}

		// walkback
		if (reset.contains(myPosition())) {
			walk.setMinDistanceThreshold(0);
			walk.setEnergyThreshold(25);
			execute(walk);
          	status = "Walking back";
        }

Now my problem comes into play when my player is resetting aggro and walks to the reset spot. 

IT works smoothly every now and then but sometimes he just sits in the reset spot and doesnt walk back to the crabs. 

The script is able to walk to the rockcrab area with no problem if I start in the reset area.  And sometimes it works 100% smoothly. 

I have a status check and when my player gets stuck the status is 'Walking Back'. 

Is there any way to check what is actually going on and why my player wont walk back to crabs 90% of the time? IS the reset area I'm using too small?

Edited by domp
  • Like 1
Posted

I'm not sure why it isn't walking back. Check osbot log to see if any useful errors pop up (Settings > Toggle logger).

5 hours ago, domp said:

Is there any way to check what is actually going on and why my player wont walk back to crabs 90% of the time?

To debug we need to understand why the problem is occurring, rather than guessing. Try placing some log messages after each if and see what's printed in the logs during the bug. This will show where the script is stuck.

if (condition 1) {
	log("1");
	// Rest of block code
}
else if (condition 2) {
	log("2");
	// Rest of block code
}

Let us know what you find out.

Posted
2 hours ago, d0zza said:

WalkingEvents are only to be used for shorter distances and so there's a chance that a walk-able path isn't being found 90% of the time. Try use a WebWalkEvent instead and see how that goes.

The problem with that is I'm afking in between two rock crabs so if my player is not in the exact position he needs to be then it won't aggro both crabs.
I believe it's a default deviation of 2 so that wouldn't work.

I'm going to try a different reset spot, maybe a little closer and not in all the trees and see if It runs smooth

Posted

Hid all the posts that didn't answer your question and gave you alternative answers instead. The answer to your question is that when you use WalkingEvent(area), the event will try and create a path to that destination using an algorithm. However if that destination is not in a loaded region, it will fail. To overcome this, you can create a manual path:
 

 

To walk to a specific position, as others have previously suggested, set the mindistancethreshold to 0. So to reiterate, it only works "sometimes" because the area you are trying to reach is only "sometimes" loaded. 

Posted (edited)

@Alek

 


	Position rcarea = new Position(2701, 3719, 0);
	Area rcarea1 = new Area(2702, 3719, 2701, 3719);
	Area reset = new Area(2705, 3687, 2699, 3689);
	WalkingEvent walk = new WalkingEvent(rcarea);
	
	private Position[] resetpath = {
		new Position(2698, 3695, 0), new Position(2699, 3708, 0), 
		new Position(2701, 3719, 0)
	
		
	};
//	

	private ExperienceTracker expTracker;
	long timer = 0L;
	public long startTime = System.currentTimeMillis();
	String status = "Idle";

	public void onStart() throws InterruptedException {
		startExp = skills.getExperience(Skill.STRENGTH);
		if (!combat.isAutoRetaliateOn()) {
			combat.toggleAutoRetaliate(true);
			expTracker = getExperienceTracker();
		}

	}

	@Override
	public int onLoop() throws InterruptedException {
		
		
		// attack
		if (rcarea1.contains(myPosition())) {
			status = "Attacking";
			log("in rcarea auto-retaliating");
			timer += 1L;

			antiban();
		}
		// reset
		if (timer >= 250) {
			status = "Reset aggro";
			log("timer hit 250, resetting aggro");
			getWalking().walk(reset);
			camera.moveYaw(random(0, 360));
			timer = 0L;

		}

		// walkback
		if (reset.contains(myPosition())) {
			status = "Walking back";
			log("walking back");
			getWalking().walkPath(resetpath);
			camera.moveYaw(random(0, 360));

		}

		return (random(1000, 3000));

	}

I get an error at getWalking().walkpath(resetpath);  saying the method is not applicable.  Only webWalk seems to get rid of the error.

EDIT: tried webWalk and it reaches final destination in the middle of the path. seems to walk to the closest position and end webwalk.  Any help? Should the path have more points? They can all be seen by each other on the minimap

Edited by domp

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