tysonn 0 Posted July 18, 2016 Hey guys, I am trying to create a small power fisher while I do some other work and I am trying to highlight all the npcs around me. can highlight the npcs just fine using getNpcs().closest("Fishing spot") but obviously that just highlights the closest spot, I am trying to highlight all shark spots (that have option Net instead of Cage) but when I use something like for (NPC n : getNpcs().all(1511)) g.drawPolygon(n.getTile().getPolygon()); it just freezes the entire screen and client until I stop the script. Am I doing something wrong? Somebody please point me in the right direction. Thanks! Nevermind, I fixed it. Had to make sure that the NPC was actually visible on the screen before trying to draw it's polygon.
Calculus 30 Posted July 19, 2016 It might be helpful to store the polygons in a different loop, instead of onPaint(). That way you're not going to destroy your CPU by having it do all those calculations 1000 times per second... Try doing something like this: //Global variable private List<Polygon> polygonList; //Put this in your onLoop() polygonList = getNpcs().all(1511).stream().map(n -> n.getTile().getPolygon()).collect(Collectors.toList()); //Put this in your onPaint() for(Polygon p : polygonList) g.drawPolygon(p);
Recommended Posts
Archived
This topic is now archived and is closed to further replies.