harrypotter Posted March 21, 2017 Posted March 21, 2017 (edited) According to the API I can check if an entity is reachable: https://osbot.org/api/org/osbot/rs07/api/DoorHandler.html#canReachOrOpen-org.osbot.rs07.api.model.Entity- However the following always returns true even if it should return false: NPC juliet = script.npcs.closest("Juliet"); log(getDoorHandler().canReachOrOpen(juliet.getPosition())); Edited March 22, 2017 by harrypotter
Magarac Posted March 21, 2017 Posted March 21, 2017 (edited) 22 minutes ago, harrypotter said: According to the API I can check if an entity is reachable: https://osbot.org/api/org/osbot/rs07/api/DoorHandler.html#canReachOrOpen-org.osbot.rs07.api.model.Entity- However the following always returns true even if it should return false: NPC juliet = script.npcs.closest("Juliet"); log(getDoorHandler().canReachOrOpen(juliet)); Juliet isn't a door though? I'd do something like this: if (julietArea.contains(myPlayer()) { RS2Object door = getObjects.closest("Door"); if (door != null && door.hasAction("Open")) { door.interact("Open"); } // then rest of code to interact with the NPC "Juliet" } EDIT: julietArea being the area you are in when wanting to interact with Juliet. Use @Explv 's dope map to find the area for it by going up a floor (https://explv.github.io/). Edited March 21, 2017 by Magarac
harrypotter Posted March 22, 2017 Author Posted March 22, 2017 (edited) 19 minutes ago, Magarac said: Juliet isn't a door though? I'd do something like this: if (julietArea.contains(myPlayer()) { RS2Object door = getObjects.closest("Door"); if (door != null && door.hasAction("Open")) { door.interact("Open"); } // then rest of code to interact with the NPC "Juliet" } EDIT: julietArea being the area you are in when wanting to interact with Juliet. Use @Explv 's dope map to find the area for it by going up a floor (https://explv.github.io/). Sorry my snippet should read: NPC juliet = script.npcs.closest("Juliet"); log(getDoorHandler().canReachOrOpen(juliet.getPosition())); This still returns true for the position, even if behind a door. Edited March 22, 2017 by harrypotter 1
Magarac Posted March 22, 2017 Posted March 22, 2017 3 minutes ago, harrypotter said: Sorry my snippet should read: NPC juliet = script.npcs.closest("Juliet"); log(getDoorHandler().canReachOrOpen(juliet.getPosition())); This still returns true for the area, even if behind a door. Hmm I'm not exactly sure why it's returning true, other than the fact that (reach || open) might be working like an OR statement does and since it CAN open the door it returns true always. Try doing the door check like I posted, cause doors always have either a "Open" or "Close" option. 1
harrypotter Posted March 22, 2017 Author Posted March 22, 2017 2 minutes ago, Magarac said: Hmm I'm not exactly sure why it's returning true, other than the fact that (reach || open) might be working like an OR statement does and since it CAN open the door it returns true always. Try doing the door check like I posted, cause doors always have either a "Open" or "Close" option. You could be right, flew straight over my head the naming there haha! 1
Team Cape Posted March 22, 2017 Posted March 22, 2017 if(getMap().canReach(juliet)) juliet.inteact("Talk-to"); else getWalking().webWalk(juliet.getPosition()); //or if you want to manually handle the door feel free to Quote Juliet isn't a door though? I died laughing after reading this 1