roguehippo Posted November 6, 2017 Posted November 6, 2017 Hello i was just wondering what everyone thought the best way to interact with tiles is. What i mean by this specifically is how would i find a specific game tile at a position, then Be able to Overlay color over the tile, walk to the tile, check if it has an object on it, like a hunter trap or a tree.
Explv Posted November 6, 2017 Posted November 6, 2017 (edited) ??? Maybe look at the API? You can make a Position using: Position position = new Position(x, y, z); Walk to it using a WalkingEvent with minDistanceThreshold set to 0: WalkingEvent walkingEvent = new WalkingEvent(position); walkingEvent.setMinDistanceThreshold(0); execute(walkingEvent); Check if an object is on the position by using filter (or singleFilter, or whatever else): List<RS2Object> objectsOnPos = getObjects().filter(new PositionFilter<>(position)); // or boolean isHunterTrapOnPos = !getObjects().filter(new PositionFilter<>(position), new NameFilter<>("Hunter trap")).isEmpty(); Draw the position on screen using: graphics2D.drawPolygon(position.getPolygon(getBot()); Edited November 6, 2017 by Explv 2
HunterRS Posted November 6, 2017 Posted November 6, 2017 (edited) Color tile: Position tile; g.fillPolygon(tile.getPolygon(bot)); Check if specif object on tile: RS2Object obj; Position tile; if(obj.getPosition().equals(tile){ //your code here } You can combine the above code with a filter to filter out objects based on name or what ever you want Edited November 6, 2017 by HunterRS