itumi Posted September 1, 2022 Share Posted September 1, 2022 (edited) Made this script out of bits and pieces, kills chompys and does NOT pluck them, got my 1000kc with it and have not used it since, im sure it has some bugs in it. Instructions: Start in Kandarin (South west of castle wars, near the swamp). Have any amount of ogre bellows in inventory. Have ogre bow or ogre comp bow and arrows equipped. NB: roast me on my shitty code NB2: Kill counter does not work properly Code: Spoiler import org.osbot.rs07.api.ui.Message; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import java.awt.*; import java.util.concurrent.TimeUnit; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.utility.ConditionalSleep; import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.api.Chatbox; @ScriptManifest(name = "ChompyHunter", author = "itumi", version = 1.0, info = "", logo = "") public class ChompyHunter extends Script { // NPCS int npcSwampToad = 1473; int npcChompyBirdAlive = 1475; int npcChompyBirdDead = 1476; // OBJECTS int objSwampBubbles = 684; int objBloatedToad = 1474; // ITEMS int itemOgreBellowsZero = 2871; int itemOgreBellowsThree = 2872; int itemOgreBellowsTwo = 2873; int itemOgreBellowsOne = 2874; int itemBloatedToad = 2875; int itemOgreArrow = 2866; int itemOgreBow = 2883; int onToad = 0; int cantReach = 0; int killCount = 0; // AREA Area areaChompyArea = new Area(2392, 3048, 2402, 3039); // TIMER private long timeBegan; private long timeRan; private enum State { FILL_BELLOWS, CATCH_TOAD, PLACE_TOAD, KILL_CHOMPY, IDLE }; private State getState() { /* KILL CHOMPY */ if (npcs.closest(npcChompyBirdAlive) != null){ return State.KILL_CHOMPY; } /* PLACE TOAD */ else if(getInventory().contains(itemBloatedToad) && !myPlayer().isAnimating() && !myPlayer().isMoving()){ return State.PLACE_TOAD; } /* CATCH TOAD */ else if(!getInventory().contains(itemBloatedToad) && !myPlayer().isAnimating() && !myPlayer().isMoving() && bellowsEmpty() != true) { return State.CATCH_TOAD; } /* FILL BELLOWS */ else if(bellowsEmpty() && !myPlayer().isAnimating() && !myPlayer().isMoving()) { return State.FILL_BELLOWS; } return State.IDLE; } @Override public void onStart() { timeBegan = System.currentTimeMillis(); getWalking().webWalk(areaChompyArea); } @Override public void onExit() { //Code here will execute after the script ends } @Override public int onLoop() throws InterruptedException { switch(getState()){ case KILL_CHOMPY: killChompy(); break; case PLACE_TOAD: placeToad(); break; case CATCH_TOAD: catchToad(); break; case FILL_BELLOWS: fillBellows(); break; default: break; } return 100; } public void killChompy() throws InterruptedException { if (myPlayer().getInteracting() == null) { NPC chompy = getNpcs().closest(npc -> npc.getName().equalsIgnoreCase("chompy bird") && npc.getHealthPercent() > 0 && npc.isAttackable() && getMap().canReach(npc)); if (random(1, 2) == 1) { camera.toEntity(npcs.closest(npcChompyBirdAlive)); } sleep(random(80, 950)); if (chompy != null) { if (npcs.closest(npcChompyBirdAlive) != null) { log("Killing Chompy."); npcs.closest(npcChompyBirdAlive).interact("Attack"); ++killCount; } new ConditionalSleep(5000, 100) { @Override public boolean condition() throws InterruptedException { return myPlayer().getInteracting() != null; } }.sleep(); } } else { new ConditionalSleep(1000, 20) { @Override public boolean condition() throws InterruptedException { return myPlayer().getInteracting() == null; } }.sleep(); } } @Override public void onMessage(Message m) throws InterruptedException { if (m.getMessage().contains("There is a bloated toad already placed at this location.")) { onToad = 1; } else { onToad = 0; } if (m.getMessage().contains("I can't reach that!")) { cantReach = 1; } else { cantReach = 0; } } public void placeToad() throws InterruptedException { if(onToad == 1) { log("Standing on bloated toad, moving."); walking.walk(areaChompyArea.getRandomPosition()); onToad = 0; } else { log("Dropping toad."); inventory.interact("Drop", itemBloatedToad); sleep(random(3000, 4000)); } new ConditionalSleep(4000) { @Override public boolean condition() throws InterruptedException { return (!getInventory().contains(itemBloatedToad)); } }.sleep(); } public void catchToad() throws InterruptedException { if(! npcs.closest(npcSwampToad).isVisible()) { camera.toEntity(npcs.closest(npcSwampToad)); } if(!myPlayer().isAnimating()) { log("Inflating toad."); npcs.closest(npcSwampToad).interact("Inflate"); sleep(random(550, 1050)); } new ConditionalSleep(4000) { @Override public boolean condition() throws InterruptedException { return (getInventory().contains(itemBloatedToad) || !myPlayer().isMoving()); } }.sleep(); } public void fillBellows() { if(! objects.closest(objSwampBubbles).isVisible()) { camera.toEntity(objects.closest(objSwampBubbles)); } if(cantReach == 1) { log("Cant reach swamp, moving."); walking.walk(areaChompyArea.getRandomPosition()); cantReach = 0; } else { log("Filling Bellows."); objects.closest(objSwampBubbles).interact("Suck"); } new ConditionalSleep(4000) { @Override public boolean condition() throws InterruptedException { return (!bellowsEmpty()); } }.sleep(); } public boolean bellowsEmpty() { if(!getInventory().contains(itemOgreBellowsThree) || !getInventory().contains(itemOgreBellowsTwo) || !getInventory().contains(itemOgreBellowsOne)) { return getInventory().contains(itemOgreBellowsZero); } else { return getInventory().contains(itemOgreBellowsThree) || !getInventory().contains(itemOgreBellowsTwo) || !getInventory().contains(itemOgreBellowsOne); } } public int getOgreBellowsId() { if(getInventory().contains(itemOgreBellowsThree)) { return itemOgreBellowsThree; } else if (getInventory().contains(itemOgreBellowsTwo)) { return itemOgreBellowsTwo; } else if (getInventory().contains(itemOgreBellowsOne)) { return itemOgreBellowsOne; } else if (getInventory().contains(itemOgreBellowsZero)) { return itemOgreBellowsZero; } else { log("Inventory contains no Ogre Bellows"); return 0; } } @Override public void onPaint(Graphics2D g) { Graphics2D gr = g; timeRan = System.currentTimeMillis() - this.timeBegan; g.drawString("Time: " + ft(timeRan), 10, 300); g.drawString("State: " + getState().toString().replace('_', ' '), 10, 315); g.drawString("Kill Count: " + killCount, 10, 330); } private String ft(long duration) { String res = ""; long days = TimeUnit.MILLISECONDS.toDays(duration); long hours = TimeUnit.MILLISECONDS.toHours(duration) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration)); long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration)); long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration)); if (days == 0) { res = (hours + ":" + minutes + ":" + seconds); } else { res = (days + ":" + hours + ":" + minutes + ":" + seconds); } return res; } } ChompyHunter.jar Edited September 1, 2022 by itumi Added NB-s Quote Link to comment Share on other sites More sharing options...