April 6, 201510 yr Wanting to do something like camera.toPosition(getBank().getPosition()); I don't think there is anything in built for this, that I have seen atleast. Any help appreciated
April 6, 201510 yr getBank() returns an instance of the Bank class, the bank class does not represent an actual bank but rather an "API regarding bank functionality".
April 6, 201510 yr Author getBank() returns an instance of the Bank class, the bank class does not represent an actual bank but rather an "API regarding bank functionality". Though it has to get the actual bank booth object / npc from somewhere right? I'm just looking for a way to access this so I can get its position when it finds one Edited April 6, 201510 yr by Mykindos
April 6, 201510 yr Though it has to get the actual bank booth object / npc from somewhere right? I'm just looking for a way to access this so I can get its position when it finds one Doesn't work that way ^^ You have to find the entity yourself
April 6, 201510 yr Though it has to get the actual bank booth object / npc from somewhere right? I'm just looking for a way to access this so I can get its position when it finds one You'll have to find the bank/npc yourself and interact with it
April 6, 201510 yr RS2Object booth = getObjects().closest("Bank booth); booth.interact("Bank"); //clicks bank booth.getPosition(); //returns position But you should already know that right?
April 6, 201510 yr Author RS2Object booth = getObjects().closest("Bank booth); booth.interact("Bank"); //clicks bank booth.getPosition(); //returns position But you should already know that right? I was looking for a more convenient method of getting all types of banks, like npcs as well. Unless OSBot doesnt interact with npc banks, in that case I am retarded.
April 6, 201510 yr I was looking for a more convenient method of getting all types of banks, like npcs as well. Unless OSBot doesnt interact with npc banks, in that case I am retarded. There is no way to detect globally all banks. You can just change it to npc then.
April 6, 201510 yr If you want to account for both NPCs & Objects: 1. Put all NPCs and RS2Objects in an Entity list. 2. Filter that list for entities that have a "Bank" action. 3. Take a random entity from the list or sort the whole list by distance using a Comparator and take the first one (if you'd like the closest). 4.Profit. Alternatively you can look for the closest NPC and then for the closest Object and then compare the two and take the closest one.
April 6, 201510 yr Author There is no way to detect globally all banks. You can just change it to npc then. Yeah, will have to do that. Dont know why I didn't just look at this from the start
April 6, 201510 yr You can make ur own method for this by adding in a BankArea enum that contains the locations of all banks.
April 13, 201510 yr private final String bankBooth = "Bank Booth"; Entity booth = getObjects().closest(bankBooth); if (booth != null) { camera.toPosition(booth.getPosition()); } /* or */ Entity booth = getObjects().closest(bankBooth); if (booth != null) { camera.toPosition(new Position(booth.getPosition())); } all I can think of Edited April 13, 201510 yr by Acinate
April 13, 201510 yr 1) Load all Rs2object 2) Load all Npcs 3) Filter them by name or Abnk option 4) Interact with the closest one possible? Shouldn't be too hard to make.
April 18, 201510 yr // variables private Area bankArea = new Area(x1, y1, x2, y2); // main method private void openBank() { int x = random(1, 3); adjustCamera(); if (x == 1 || x == 2) { Entity bankBooth = objects.closest("Bank booth"); if (bankBooth.exists() && bankArea.contains(bankBooth)) { if (bankBooth.isVisible()) { bankBooth.interact("Bank"); sleepFor(500, 900); } if (!bankBooth.isVisible()) { localWalker.walk(bankBooth.getPosition(), false); sleepFor(750, 1500); } } } if (x == 3) { NPC banker = npcs.closest("Banker"); if (banker.exists() && bankArea.contains(banker)) { if (banker.isOnScreen()) { banker.interact("Bank"); sleepFor(500, 900); } if (!banker.isOnScreen()) { localWalker.walk(banker.getPosition(), false); sleepFor(750, 1500); } } } } // true or false methods private boolean bankScreenOpen() { return this.bank.isOpen(); } private boolean playerIsAtBank() { return this.bankArea.contains(myPlayer()); } // custom methods private void sleepFor(int x, int y) { try { sleep(random(x, y)); } catch (InterruptedException e) { log("interrupted sleep exception"); e.printStackTrace(); } } private void adjustCamera() { if (camera.getPitchAngle() <= 60) { camera.toTop(); } } hope this helps! I plan on releasing some tutorials soon to help the community grow, since I noticed there was little to no tutorials. In the walk method, you can change the false to true to change the camera angle sometimes. you should also be able to figure out how to get the camera to do your bidding with the examples above. Normally i only move the camera up and down when i play which is why i have adjustCamera(). i use it quite often actually. Edited April 18, 201510 yr by shiny greninja
Create an account or sign in to comment