Jump to content

Walking A Path --> Newer API


Recommended Posts

Posted

Title says it all, I've been on Scripting Hiatus since my Goat Killer due to complications but since I'm back I have noticed the API has removed or at least deprecated the use of certain walk methods.

 

I was wondering if someone could point me in the right direction

 

I've tried

// path
	private List<Position> toBank = new ArrayList<Position>();
	private List<Position> toShelf = new ArrayList<Position>();
	
	@Override
	public void onStart() {
		try {
			toBank.add(new Position(random(3323, 3320), random(3137,3141), 0));
			toBank.add(new Position(random(3318, 3321), random(3144,3147), 0));
			toBank.add(new Position(random(3307,3313), random(3146, 3152), 0));
			toBank.add(new Position(random(3301,3305), random(3149,3152), 0));
			toBank.add(new Position(random(3288,3297), random(3147, 3150), 0));
			toBank.add(new Position(random(3280, 3289), random(3150, 3153), 0));
			toBank.add(new Position(random(3276, 3279), random(3155, 3158), 0));
			toBank.add(new Position(random(3273, 3278), random(3160, 3163), 0));
			toBank.add(new Position(random(3269, 3272), random(3162,3170), 0));
			
			// to shelf
			toShelf.add(new Position(random(3269, 3272), random(3162,3170), 0));
			toShelf.add(new Position(random(3273, 3278), random(3160, 3163), 0));
			toShelf.add(new Position(random(3276, 3279), random(3155, 3158), 0));
			toShelf.add(new Position(random(3280, 3289), random(3150, 3153), 0));
			toShelf.add(new Position(random(3288,3297), random(3147, 3150), 0));
			toShelf.add(new Position(random(3301,3305), random(3149,3152), 0));
			toShelf.add(new Position(random(3307,3313), random(3146, 3152), 0));
			toShelf.add(new Position(random(3318, 3321), random(3144,3147), 0));
			toShelf.add(new Position(random(3323, 3320), random(3137,3141), 0));
			
		} catch (Exception e) {
			log(e);
		}
	}

But it doesn't run at all on walking, everything else runs fine in the script. Could anyone help out, I'm using walkPath(List <Position> l)

 

Posted

Just make 2 areas where you want to walk

 

Area area1 = new Area(x,y,x,y);

Area area2 = new Area(x,y,x,y);

 

And simply walk to any one of them by doing:

 

getWalking().webWalk(area1);

getWalking().webWalk(area2);

 

by using the webwalker you dont need to have predefined paths, it makes a new path for itself to walk which is far better.

Posted

If you need to enable run, use the method in the WebWalkEvent

Avoid using the deprecated walking methods, as they will be removed soon. You can find the available ones here

 

Nah it's not that I need run enabled, its that the walking method doesn't work. Though I'm going to try a step at a time to get it to.

Just make 2 areas where you want to walk

 

Area area1 = new Area(x,y,x,y);

Area area2 = new Area(x,y,x,y);

 

And simply walk to any one of them by doing:

 

getWalking().webWalk(area1);

getWalking().webWalk(area2);

 

by using the webwalker you dont need to have predefined paths, it makes a new path for itself to walk which is far better.

 

Awesome! I'll try it out which makes since for it to work. Question though, does it work by placing the two areas next to eachother or far apart.

 

Say

 

[Area1][Area2][Area3][Area4] -> I've arrived

 

or

 

[Area1] ------> [Area2] -> I've arrived

Posted

Nah it's not that I need run enabled, its that the walking method doesn't work. Though I'm going to try a step at a time to get it to.

 

Awesome! I'll try it out which makes since for it to work. Question though, does it work by placing the two areas next to eachother or far apart.

 

Say

 

[Area1][Area2][Area3][Area4] -> I've arrived

 

or

 

[Area1] ------> [Area2] -> I've arrived

You can make an area in lumby and walk from it to cammy with one line, the spacing between the areas can be as big as you want.

It will even handle boats, obstacles for you.

Posted (edited)

Title says it all, I've been on Scripting Hiatus since my Goat Killer due to complications but since I'm back I have noticed the API has removed or at least deprecated the use of certain walk methods.

 

I was wondering if someone could point me in the right direction

 

I've tried

// path
	private List<Position> toBank = new ArrayList<Position>();
	private List<Position> toShelf = new ArrayList<Position>();
	
	@Override
	public void onStart() {
		try {
			toBank.add(new Position(random(3323, 3320), random(3137,3141), 0));
			toBank.add(new Position(random(3318, 3321), random(3144,3147), 0));
			toBank.add(new Position(random(3307,3313), random(3146, 3152), 0));
			toBank.add(new Position(random(3301,3305), random(3149,3152), 0));
			toBank.add(new Position(random(3288,3297), random(3147, 3150), 0));
			toBank.add(new Position(random(3280, 3289), random(3150, 3153), 0));
			toBank.add(new Position(random(3276, 3279), random(3155, 3158), 0));
			toBank.add(new Position(random(3273, 3278), random(3160, 3163), 0));
			toBank.add(new Position(random(3269, 3272), random(3162,3170), 0));
			
			// to shelf
			toShelf.add(new Position(random(3269, 3272), random(3162,3170), 0));
			toShelf.add(new Position(random(3273, 3278), random(3160, 3163), 0));
			toShelf.add(new Position(random(3276, 3279), random(3155, 3158), 0));
			toShelf.add(new Position(random(3280, 3289), random(3150, 3153), 0));
			toShelf.add(new Position(random(3288,3297), random(3147, 3150), 0));
			toShelf.add(new Position(random(3301,3305), random(3149,3152), 0));
			toShelf.add(new Position(random(3307,3313), random(3146, 3152), 0));
			toShelf.add(new Position(random(3318, 3321), random(3144,3147), 0));
			toShelf.add(new Position(random(3323, 3320), random(3137,3141), 0));
			
		} catch (Exception e) {
			log(e);
		}
	}

But it doesn't run at all on walking, everything else runs fine in the script. Could anyone help out, I'm using walkPath(List <Position> l)

 

 

If you want to make a list like that it would be a lot cleaner to do:

private final List<Position> TO_BANK = Arrays.asList(new Position[]{

    new Position(random(3323, 3320), random(3137,3141), 0));
    new Position(random(3318, 3321), random(3144,3147), 0);
    new Position(random(3307,3313), random(3146, 3152), 0);
    new Position(random(3301,3305), random(3149,3152), 0);
    new Position(random(3288,3297), random(3147, 3150), 0);
    new Position(random(3280, 3289), random(3150, 3153), 0);
    new Position(random(3276, 3279), random(3155, 3158), 0);
    new Position(random(3273, 3278), random(3160, 3163), 0);
    new Position(random(3269, 3272), random(3162,3170), 0);
});

But yeah, use the web walker instead:

getWalking().webWalk(new Position(0, 0, 0));
Edited by Explv

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