Jump to content

How to paint NPC?


Recommended Posts

Posted
@Override
public void onPaint(Graphics2D g){
        
    g.setColor(Color.RED);
    MiniMapTileDestination npcTileDest = new MiniMapTileDestination(getBot(), npc.getPosition());
    g.fill(npcTileDest.getBoundingBox().getBounds2D());
}

Can I also use this method to paint the NPC it self on the screen instead of on the minimap?

Posted (edited)

Can I also use this method to paint the NPC it self on the screen instead of on the minimap?

 

For that you would do something like:

g.fill(npc.getModel().getBoundingBox(npc.getGridX(), npc.getGridY(), npc.getZ()));

Note: use g.fill to create a filled in rectangle, or g.draw if you just want the outline.

Edited by Explv
Posted

It's been a while since I've played with these methods, but if I remember correctly there is a drawModel() method.

 

When you click the [x] NPCs debug option, it draws an outline around all NPC models in the game. I reversed OSBot and inserted code to see how it was doing this; there is an internal method called something like:

 

GraphicUtilities.drawModel(obj, color, x, y)

 

I am just going off memory here, but it was definitely the GraphicUtilities class.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...