Jump to content

walking and stairs / obstacles


Recommended Posts

Posted

So I got banking working, fighting and other things, but I come across a problem, walking to stairs and then going up them. 


			localWalker.walkPath(fromBankToStairs);
			Player player = myPlayer();
			int x = player.getPosition().getX();
			int y = player.getPosition().getY();

			if ((x > 3205) && (x < 3207) && (y > 3209) && (y < 3211)) {
				log("x : " + x + " y : " + y);
				log("we are at the stairs!");
				objects.closest("Staircase").interact("Climb-down");
			
				int z = player.getPosition().getZ();
				if (z == 1) {
					objects.closest("Staircase").interact("Climb-down");
				}
			} else {
				log("we are lost again..");
			}

What I did is walk to the stairs and if the player is near the stairs it should go down, but this does not working, does localWalker have a callback to see if the path is fully walked and then continue the script? 

Posted

So I got banking working, fighting and other things, but I come across a problem, walking to stairs and then going up them. 


			localWalker.walkPath(fromBankToStairs);
			Player player = myPlayer();
			int x = player.getPosition().getX();
			int y = player.getPosition().getY();

			if ((x > 3205) && (x < 3207) && (y > 3209) && (y < 3211)) {
				log("x : " + x + " y : " + y);
				log("we are at the stairs!");
				objects.closest("Staircase").interact("Climb-down");
			
				int z = player.getPosition().getZ();
				if (z == 1) {
					objects.closest("Staircase").interact("Climb-down");
				}
			} else {
				log("we are lost again..");
			}

What I did is walk to the stairs and if the player is near the stairs it should go down, but this does not working, does localWalker have a callback to see if the path is fully walked and then continue the script? 

 

 

if ((x > 3205) && (x < 3207) && (y > 3209) && (y < 3211)) {

Use area pls

 

+ getLocalWalker().waitUntilidle() is your best bet for the walking.

Posted (edited)
if ((x > 3205) && (x < 3207) && (y > 3209) && (y < 3211)) {

Use area pls

 

+ getLocalWalker().waitUntilidle() is your best bet for the walking.

 

 

Fixed the areas, but still seem to have a problem with walking, I get the bot to start walking when it is at the bank with an empty inventory  but once it is at the stairs it stops 

	localWalker.walkPath(fromBankToStairs);
			localWalker.waitUntilIdle();
			Player player = myPlayer();
			log(localWalker.toString());
			if (UPPER_STAIRCASE_AREA.contains(myPlayer())) {
				log("we are at the stairs!");
				objects.closest("Staircase").interact("Climb-down");

				int z = player.getPosition().getZ();
				if (z == 1) {
					objects.closest("Staircase").interact("Climb-down");
				}
			} else {
				log("we are lost again..");
			}

Edited by KlaAz0r
Posted

 

Fixed the areas, but still seem to have a problem with walking, I get the bot to start walking when it is at the bank with an empty inventory  but once it is at the stairs it stops 

	localWalker.walkPath(fromBankToStairs);
			localWalker.waitUntilIdle();
			Player player = myPlayer();
			log(localWalker.toString());
			if (UPPER_STAIRCASE_AREA.contains(myPlayer())) {
				log("we are at the stairs!");
				objects.closest("Staircase").interact("Climb-down");

				int z = player.getPosition().getZ();
				if (z == 1) {
					objects.closest("Staircase").interact("Climb-down");
				}
			} else {
				log("we are lost again..");
			}

 

try changing

 

if (UPPER_STAIRCASE_AREA.contains(myPlayer())) {

to

 

if (UPPER_STAIRCASE_AREA.contains(myPosition().getX(), myPosition().getY())) {

This ignores whatever Z value the area might have (probably 0)

Posted

try changing

to

This ignores whatever Z value the area might have (probably 0)

 

figured that out, what I did was:

		if (BANK_AREA.contains(myPlayer().getPosition().getX(), myPlayer()
				.getPosition().getY(), 0)
				&& inventory.isEmpty())
			return State.WALKING_TO_UPPER_STAIRS;

		if (myPlayer().getPosition().getZ() == 1 && inventory.isEmpty())
			return State.GOING_DOWN_STAIRS;

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