qverkk Posted December 25, 2015 Share Posted December 25, 2015 How to check if npc was interacting other player within last 10 seconds? for(Player player : getPlayers().getAll()){ List<NPC> guards = getNpcs().filter(npc -> npc.getName().equals("Guard") && npc.getLevel() == 1337 && npc.isInteracting(player) ); if(guards.size() > 0 && inventory.contains(food)){ if(room6.contains(myPlayer()) || room6a.contains(myPlayer())) { RS2Object door1 = getObjects().closest(true, obj -> obj.getName().equals("Door") && obj.hasAction("Open") && obj.getX() == dx1 && obj.getY() == dy1); if (door1 == null) { // if doors r open doors open walk outside localWalker.walk(centerX, centerY); } else if (!room6SafeArea.contains(myPlayer())) { localWalker.walk(safeX, safeY); break; } }//if we're in safe area, sleep sleep(20000); } } Quote Link to comment Share on other sites More sharing options...
KEVzilla Posted December 25, 2015 Share Posted December 25, 2015 for(Player player : getPlayers().getAll()){ Why do you need to get all players nearby? And you could use a Timer class (which you would have to implement yourself) or.. use the /general/ Timer class of a few years back: https://github.com/dunnkers/RSBot-API/blob/master/util/Timer.java 2 Quote Link to comment Share on other sites More sharing options...
Token Posted December 25, 2015 Share Posted December 25, 2015 Get the npc and check every loop whether it is interacting or not, if it has to be interacting with other players then also check that you are not interacting with this npc. If it was interacting in a previous loop iteration and now it is no longer interacting, you start timing 10 seconds (just save the time and check if 10 seconds have passed in further loop iterations) and then you got what you wanted. 1 Quote Link to comment Share on other sites More sharing options...