smh1 0 Share Posted April 20, 2022 Hey, I was writing a sand crab script, got it to the point where it actually has to fight, and I just can't seem it to hop when other players are standing in my spot. He just keeps on hopping, even if there are no other players. Predicate<Player> OTHER_PLAYER = player -> SAND_CRAB_TRIPLE_AREA.contains(player.getTile()) && !player.getName().equals(getLocalPlayer().getName()); if (Players.localPlayer().getTile().equals(SAND_CRAB_TRIPLE)) { if (OTHER_PLAYER != null) { log("Hopping worlds, because the spot is not empty"); World world = Worlds.getRandomWorld(w -> !w.isF2P() && !w.isPVP() && w.getMinimumLevel() == 0); WorldHopper.hopWorld(world); } } Link to comment Share on other sites More sharing options...
PapaH 1 Share Posted April 20, 2022 3 hours ago, smh1 said: Hey, I was writing a sand crab script, got it to the point where it actually has to fight, and I just can't seem it to hop when other players are standing in my spot. He just keeps on hopping, even if there are no other players. Predicate<Player> OTHER_PLAYER = player -> SAND_CRAB_TRIPLE_AREA.contains(player.getTile()) && !player.getName().equals(getLocalPlayer().getName()); if (Players.localPlayer().getTile().equals(SAND_CRAB_TRIPLE)) { if (OTHER_PLAYER != null) { log("Hopping worlds, because the spot is not empty"); World world = Worlds.getRandomWorld(w -> !w.isF2P() && !w.isPVP() && w.getMinimumLevel() == 0); WorldHopper.hopWorld(world); } } You could try something along these lines, might need to change the "!player1.equals(getLocalPlayer())" to something different, the purpose of that line is to skip your player when checking for players in the area. if you need more help with what the info in the for loop means lmk for (Player player1 : Players.all()) { if (!player1.equals(getLocalPlayer())) { if (chickensRangeArea.contains(player1)) { log("hop world"); } } } Link to comment Share on other sites More sharing options...
smh1 0 Author Share Posted April 20, 2022 Thanks a lot, PapaH! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.