Jump to content

No entities found at lumbridge bank


lisabe96

Recommended Posts

Trying to bank at the lumbridge bank at the 2nd floor of the caslte.

However when I tried to grab a banker or a bank booth with .closest("Banker");

It didn't find the bankbooth/banker.

 

So I tried looping myself through all the RS2Objects in the area to find a bank booth,

but it returned nothing.

 

Am I missing something?

for (RS2Object obj : script.getObjects().getAll()) {
  if (obj.getPosition().distance(script.myPosition()) < 10) {
    script.log(obj.getName());
    if (obj.hasAction("Bank")) {
      obj.interact("Bank");
      return true;
    }
  }
}
Edited by lisabe96
Link to comment
Share on other sites


Have you considered trying the Bank API

 

@Override
    public int onLoop() throws InterruptedException {        
        if (Banks.LUMBRIDGE_UPPER.contains(myPlayer())) {
            if (!getBank().isOpen()) {
                if (getBank().open()) {
                    new ConditionalSleep(5000, 6000) {
                        @Override
                        public boolean condition() throws InterruptedException {
                            return getBank().isOpen();
                        }
                    }.sleep();
                }
            }
        }
        return random(500, 900);
    }
Link to comment
Share on other sites

 

Have you considered trying the Bank API

 

@Override
    public int onLoop() throws InterruptedException {        
        if (Banks.LUMBRIDGE_UPPER.contains(myPlayer())) {
            if (!getBank().isOpen()) {
                if (getBank().open()) {
                    new ConditionalSleep(5000, 6000) {
                        @Override
                        public boolean condition() throws InterruptedException {
                            return getBank().isOpen();
                        }
                    }.sleep();
                }
            }
        }
        return random(500, 900);
    }

I did now and It didn't work.

Logged the stages and it never even found my player being in the bank area.

Link to comment
Share on other sites

Firstly "Banker" is a NPC not a RS2Object. 

 

Secondly, you aren't null checking the objects which are found so make sure to do that.

 

There's an NPC and Object there. So either methods will work.

 

I did now and It didn't work.

Logged the stages and it never even found my player being in the bank area.

 

Weird, I just tested it and it works for me. You sure you refreshed your RS2Object?

Edited by ZappaScripts
Link to comment
Share on other sites

There's an NPC and Object there. So either methods will work.

 

Cant tell from your code, but you are deffinetly refreshing your RS2Object right?

Well Obviously either will work, my point was if you tried getObjects().closest("Banker"); which he seems to have done it won't work due to the fact that "Banker" is an NPC instance.

  • Like 1
Link to comment
Share on other sites

Firstly "Banker" is a NPC not a RS2Object. 

 

Secondly, you aren't null checking the objects which are found so make sure to do that.

I know, originally I checked for the banker:

NPC npc = getNpcs().closest("Banker");
  if (npc != null) {
    npc.interact("Bank");
  }
}

But as that didnt work I tried the bankbooth, then I tried looping through the nearby objects

and then I came here.

None of the given solutions got it working yet

 

 

This is what I have now: (doesnt work)

if (Banks.LUMBRIDGE_UPPER.contains(myPlayer())) {
  log("in the bank"); //Doesnt print
  if (!getBank().isOpen()) {
    try {
      if (getBank().open()) {
        new ConditionalSleep(5000, 6000) {
          @Override
          public boolean condition() throws InterruptedException {
            return getBank().isOpen();
          }
        }.sleep();
      }
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
  }
} else {
  getWalking().webWalk(Banks.LUMBRIDGE_UPPER.getRandomPosition());
}
Edited by lisabe96
Link to comment
Share on other sites

Hey you might want to try this. I can't remember who posted it earlier this month but it works great for my lumbridge banking. It gets all the bank booths and returns a random one so u dont always bank the same booth. smile.png

public RS2Object getRandomBank() {

List<RS2Object> banks = getObjects().filter(obj -> obj.getName().equals("Bank booth"));
return (banks == null || banks.size() == 0) ? null : banks.get(random(banks.size() - 1));
}

Credz to: Explv

 

 

It returns a bankBooth so all you need to do is:

RS2Object bankBooth = getRandomBank();

bankBooth.interact("Bank");
Edited by ni562
Link to comment
Share on other sites

Nope ^

 

I think it's not the actual banking that is the problem becauseeee

It doesnt recognize my player being in the bank area in the first place.

I'm guessing that that is my issue, it doesnt return my player being in the bank area.

Though the player is, no clue how thats possible though

Link to comment
Share on other sites

Nope ^

 

I think it's not the actual banking that is the problem becauseeee

It doesnt recognize my player being in the bank area in the first place.

I'm guessing that that is my issue, it doesnt return my player being in the bank area.

Though the player is, no clue how thats possible though

 

 

I got you!!! have you tried doing 

BANK_FLOOR.setPlane(2);

Or in you're case 

LUMBRIDE_UPPER.setPlane(2);

You have to do this to give it a Z axis. So far you have created the banking area but it is by default on plane(0). Amiright?

 

 

I put it in the onStart() method in my scripts.

 

 

It might be this part of you're code , but most likely it's what i posted above.

if (Banks.LUMBRIDGE_UPPER.contains(myPlayer()))

I would write it the following way: 

if (LUMBRIDGE_UPPER.contains(myPlayer()))
Edited by ni562
Link to comment
Share on other sites

 

I got you!!! have you tried doing 

BANK_FLOOR.setPlane(2);

Or in you're case 

LUMBRIDE_UPPER.setPlane(2);

You have to do this to give it a Z axis. So far you have created the banking area but it is by default on plane(0). Amiright?

 

 

I put it in the onStart() method in my scripts.

 

 

It might be this part of you're code , but most likely it's what i posted above.

if (Banks.LUMBRIDGE_UPPER.contains(myPlayer()))

I would write it the following way: 

if (LUMBRIDGE_UPPER.contains(myPlayer()))

 

This seems to be the issue, however it seems to reset the plane :/

Position pos = Banks.LUMBRIDGE_UPPER.getRandomPosition();
Position bank = new Position(pos.getX(), pos.getY(), 2);
if (Movement.walkTo(script, bank)) {
  script.log("here");
}

This will print out a plane of 2, however when going to the walkTo method it prints out 0 as plane:

public static boolean walkTo(Script script, Position pos) {
	return walkTo(script, pos, false);
}
	
public static boolean walkTo(Script script, Position pos, boolean handleDoor) {
	if (!script.myPlayer().isMoving()) {
		script.log(script.myPosition().getZ() + ", " + pos.getZ());
		if (script.myPosition().distance(pos) < 3) {
			script.log("in distance");
			if (handleDoor) {
				openDoor(script, pos);
			}
			return true;
		}
		script.getWalking().webWalk(pos);
	}
	checkRunning(script);
	return false;
}

For some reason it resets to 0

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