Light17 0 Posted August 6, 2020 How do I do this? GameObject Tree = getGameObjects().getTopObjectOnTile(new Tile(3170,3454,0)); if(Tree.equals(1278)) { Im stuck
Pixel_Life 24 Posted August 6, 2020 I'm still new scripting here but let me give this a shot.. I believe you can check if the GameObject is null. GameObject tree= getGameObjects().getTopObjectOnTile(new Tile(3170, 3454, 0)); if (tree != null) { //Tree Object is on given tile //interact } else { //tree Object isn't on given tile }
Pixel_Life 24 Posted August 6, 2020 if (tree.getID() == 1278) { //The 1278 Object ID is present on the given coordinate } https://dreambot.org/javadocs/org/dreambot/api/wrappers/interactive/GameObject.html#getID--
Stoned 52 Posted August 24, 2020 // Tile you want to check (x,y,z) Tile tile = new Tile(3170, 3454, 0); // Object you want to check GameObject tree = getGameObjects.closest("Tree"); if(tree.getTile().equals(tile)){ // tile has a tree else { // no tree }
None 227 Posted August 25, 2020 8 hours ago, Stoned said: // Tile you want to check (x,y,z) Tile tile = new Tile(3170, 3454, 0); // Object you want to check GameObject tree = getGameObjects.closest("Tree"); if(tree.getTile().equals(tile)){ // tile has a tree else { // no tree } // Object you want to check GameObject tree = getGameObjects().closest(f -> f.getName().equals("Tree") && f.getTile().equals(new Tile(3170, 3454, 0))); if(tree != null){ // tile has a tree else { // no tree }
Recommended Posts
Archived
This topic is now archived and is closed to further replies.