DirtyDick Posted April 13, 2022 Share Posted April 13, 2022 Hi guys - apologies in advance this is my first script but I'm trying to set up a method that locates a safe 5x1 area to firemake. I've declared my current position and the position 5 tiles west of my current position to create a 5x1 area public void tileCheck() { Position myPosition = myPlayer().getPosition(); Position minusFivePosition = new Position((myPosition.getX()-5), myPosition.getY(), myPosition.getZ()); Area safeToFiremake = new Area(minusFivePosition, myPosition); From here, I'm a bit stuck. I want to create an if statement that says "If safeToFiremake does not contain any objects, firemake, else move somewhere else" I've been browsing the api for a while and I couldn't find a way to check a defined area doesn't contain any objects - I would be grateful for any advice please Quote Link to comment Share on other sites More sharing options...
Gunman Posted April 13, 2022 Share Posted April 13, 2022 1 hour ago, DirtyDick said: Hi guys - apologies in advance this is my first script but I'm trying to set up a method that locates a safe 5x1 area to firemake. I've declared my current position and the position 5 tiles west of my current position to create a 5x1 area public void tileCheck() { Position myPosition = myPlayer().getPosition(); Position minusFivePosition = new Position((myPosition.getX()-5), myPosition.getY(), myPosition.getZ()); Area safeToFiremake = new Area(minusFivePosition, myPosition); From here, I'm a bit stuck. I want to create an if statement that says "If safeToFiremake does not contain any objects, firemake, else move somewhere else" I've been browsing the api for a while and I couldn't find a way to check a defined area doesn't contain any objects - I would be grateful for any advice please Look at the method getEmptyPosition near the bottom, you could just take it and change it around a bit to check a full area https://github.com/Explv/Tutorial-Island/blob/master/src/sections/SurvivalSection.java 1 Quote Link to comment Share on other sites More sharing options...
DirtyDick Posted April 14, 2022 Author Share Posted April 14, 2022 6 hours ago, Gunman said: Look at the method getEmptyPosition near the bottom, you could just take it and change it around a bit to check a full area https://github.com/Explv/Tutorial-Island/blob/master/src/sections/SurvivalSection.java Perfect - thank you so much! Quote Link to comment Share on other sites More sharing options...