cammofunk 2 Posted March 16, 2018 Whats the code for checking if another player is in a specific tile or area?
7804364 231 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()); }
cammofunk 2 Author 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?
Nex 2546 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..
cammofunk 2 Author 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
Articron 746 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?
cammofunk 2 Author 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
una_maquina 36 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.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.