Light17 0 Share Posted August 6, 2020 How do I do this? GameObject Tree = getGameObjects().getTopObjectOnTile(new Tile(3170,3454,0)); if(Tree.equals(1278)) { Im stuck Link to comment Share on other sites More sharing options...
Pixel_Life 24 Share 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 } Link to comment Share on other sites More sharing options...
Pixel_Life 24 Share 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-- Link to comment Share on other sites More sharing options...
Stoned 52 Share 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 } Link to comment Share on other sites More sharing options...
None 227 Share 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 } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.