Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Issue Getting True Tile of Players and Local Player


    closetcheater

    Recommended Posts

    Hello everyone,

    I'm currently encountering a problem in my project where I can only access the tile on which a player is rendered, rather than their actual location. I believe retrieving the true tile is feasible, as demonstrated by similar functions in RuneLite plugins.

    My requirement is to determine the true tile of the nearest player, not just the rendered one. When using closestPlayer.getTile(), it appears to return only the rendered tile. For a clearer understanding, I've made a demonstration comparing this with the RuneLite plugin that accurately shows the true tile. Unfortunately, my script does not seem to replicate this functionality for the local player.

    Here is my code:

    import org.dreambot.api.methods.map.Tile;
    import org.dreambot.api.methods.interactive.Players;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.script.listener.PaintListener;
    import org.dreambot.api.wrappers.interactive.Player;
    
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Polygon;
    
    @ScriptManifest(author = "ClosetCheater", name = "Highlight Closest Player", version = 1.0, description = "Test", category = Category.MISC)
    public class HighlightClosestPlayerScript extends org.dreambot.api.script.AbstractScript implements PaintListener {
    
        private Player closestPlayer;
    
        @Override
    Highlights the closest player's tile
        public void onStart() {
            log("Script started!");
        }
    
        @Override
        public int onLoop() {
            closestPlayer = Players.closest(player -> !player.equals(Players.getLocal())); // Get closest player thats not us
            return 300; // Render twice every tick
        }
    
        @Override
        public void onPaint(Graphics g) {
            if (closestPlayer != null && closestPlayer.getTile() != null) {
                Tile tile = closestPlayer.getTile();
                Polygon poly = tile.getPolygon();
                g.setColor(new Color(255, 0, 0, 100)); 
                g.fillPolygon(poly);
                g.setColor(Color.RED);
                g.drawPolygon(poly);
            }
        }
    
        @Override
        public void onExit() {
            log("Script stopped!");
        }
    
        public static void main(String[] args) {
            // method isn't necessary for the script but is here for completeness
        }
    }

    I've recorded a comparison showing how this issue manifests in DreamBot versus how accurately RuneLite handles this with the correct API call. Unfortunately, it seems like DreamBot might not be getting the true tile during these specific scenarios unless there is another call I've missed that I should be using?

     

    Thanks

    Edited by closetcheater
    Link to comment
    Share on other sites

    • closetcheater changed the title to Issue Getting True Tile of Players and Local Player

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.