Jump to content

walking and stairs / obstacles


KlaAz0r

Recommended Posts

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? 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

 

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)

Link to comment
Share on other sites

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;

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