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
  • Painting GameObjects & Npcs\Entities in dreambot


    Luxe

    Recommended Posts

    I discussed the EDU discord with @Smokeyjay, who helped me figure out how to paint entities and objects similar to runelite and I thought I should document it for any future googlers.

     

    pK28i1n.png

    nghZ2lR.png

    173Ycqb.png

    EXd8Rim.png

    The final result turned out like this

    X2RTU3a.png

    and here is the code (with some code from my private hunting script). The code should be placed in the onPaint method

          if(this.getCurrentLeafName() != null && this.getCurrentLeafName().toLowerCase().contains("lizard")) {
                List<NPC> lizards = NPCs.all(x -> x.getName().equalsIgnoreCase(getSettings().huntingActivity.getPreyName()));
                for (NPC lizard : lizards) {
                    if(lizard.isOnScreen()) {
    
                        ViewportTools v = new ViewportTools();
                        Graphics2D g2D = (Graphics2D) graphics;
                        if (lizard != null) {
                            Model cloudModel = lizard.getModel();
                            cloudModel.drawWireFrame(graphics);
                            graphics.drawString("Animation: " + lizard.getAnimation(), lizard.getX(), lizard.getY());
                            v.getModelArea(lizard);
                            v.drawModel(g2D, lizard.getGridX(), lizard.getGridY(), lizard.getZ(), cloudModel);
    
    
                                        graphics.drawRect(
                            (int) lizard.getBoundingBox().getX(),
                            (int) lizard.getBoundingBox().getY(),
                            (int) lizard.getBoundingBox().getHeight(),
                            (int) lizard.getBoundingBox().getWidth()
                    );
                        }
    
    
                    }
                }
            }

     

    Note that drawing too many entities will slow the framerate significantly!

    Hope this helps someone else in the future!

     

     

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    On another note, does anyone know how to get a paint similar to this?

    npctag.png

     

    Link to comment
    Share on other sites

    1 hour ago, Luxe said:

    On another note, does anyone know how to get a paint similar to this?

    You can use Model#getHullBounds

    @Override
    public void onPaint(Graphics2D graphics2D){
        
        NPC banker = NPCs.closest(i -> i != null && i.getName().equals("Banker"));
        Shape shape = banker.getModel().getHullBounds(1.f);
        
        // Enable anti-aliasing for smoother lines
        graphics2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    
        // Set the color to Cyan
        graphics2D.setColor(Color.CYAN);
    
        // Set the thickness of the boarder
        graphics2D.setStroke(new BasicStroke(2.f));
        
        //Draw the shape
        graphics2D.draw(shape);
    }

    image.png.9862ff0d5262eb4f87a7feeeb056b551.png

    Link to comment
    Share on other sites

    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.