cammofunk 2 Share Posted March 16, 2018 Whats the code for checking if another player is in a specific tile or area? Link to comment Share on other sites More sharing options...
7804364 230 Share Posted March 16, 2018 to check the tile you can do: private boolean inTile() { Tile tile = new Tile(1,1); return getLocalPlayer().getTile().equals(tile); } If you want to check if the player is in the area do this: private boolean inArea() { Area area = new Area(1,1,1,1); return area.contains(getLocalPlayer()); } Link to comment Share on other sites More sharing options...
cammofunk 2 Author Share Posted March 16, 2018 to check the tile you can do: private boolean inTile() { Tile tile = new Tile(1,1); return getLocalPlayer().getTile().equals(tile); } If you want to check if the player is in the area do this: private boolean inArea() { Area area = new Area(1,1,1,1); return area.contains(getLocalPlayer()); } Hey awesome, I could use these! How would i tell if someone else is in a tile or area though? Link to comment Share on other sites More sharing options...
Nex 2542 Share Posted March 16, 2018 to check the tile you can do: private boolean inTile() { Tile tile = new Tile(1,1); return getLocalPlayer().getTile().equals(tile); } If you want to check if the player is in the area do this: private boolean inArea() { Area area = new Area(1,1,1,1); return area.contains(getLocalPlayer()); } Hey awesome, I could use these! How would i tell if someone else is in a tile or area though? getLocalPlayer().getTile() ^compare tile to area etc, works for NPC's players object etc.. Link to comment Share on other sites More sharing options...
cammofunk 2 Author Share Posted March 16, 2018 Thanks guys, I'll try my best to implement it Gah I'm confused, I'm trying to scan an area to see what other players are in it, no luck yet. helpp Link to comment Share on other sites More sharing options...
Articron 738 Share Posted March 16, 2018 Thanks guys, I'll try my best to implement it Gah I'm confused, I'm trying to scan an area to see what other players are in it, no luck yet. helpp private final Area AREA = new Area(new Tile(1000,1000), new Tile(1000,1000)); ... List<Player> playersInArea = getPlayers().all(p -> p != null && AREA.contains(p)); int amountInArea = playersInArea.size(); Does this help you? Link to comment Share on other sites More sharing options...
cammofunk 2 Author Share Posted March 16, 2018 private final Area AREA = new Area(new Tile(1000,1000), new Tile(1000,1000)); ... List<Player> playersInArea = getPlayers().all(p -> p != null && AREA.contains(p)); int amountInArea = playersInArea.size(); Does this help you? Yes! you are amazing. Anyone else having this problem make sure to import java.util.List; as you won't be prompted to in your ide. thanks a million guys Link to comment Share on other sites More sharing options...
una_maquina 35 Share Posted November 16, 2020 On 3/16/2018 at 1:12 PM, Articron said: private final Area AREA = new Area(new Tile(1000,1000), new Tile(1000,1000)); ... List<Player> playersInArea = getPlayers().all(p -> p != null && AREA.contains(p)); int amountInArea = playersInArea.size(); Does this help you? Thanks dude, this helped a ton! Just a few DB3 modifications and it's running like butter. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.