LostxMax 5 Share Posted March 4, 2016 Basic chicken fighter with antiban Very simple chicken fighter that will kill chickens and pick up feathers. I know there are 3 million of these available but eh, just wanted to say I did it. import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.tabs.Tab; import org.dreambot.api.script.AbstractScript; import org.dreambot.api.script.Category; import org.dreambot.api.script.ScriptManifest; import org.dreambot.api.utilities.Timer; import org.dreambot.api.utilities.impl.Condition; import org.dreambot.api.wrappers.interactive.NPC; import org.dreambot.api.wrappers.items.GroundItem; import java.awt.*; @ScriptManifest(name = "LostChickens", author = "LostxMax", description = "Basic Chicken Killer", version = 2.0, category = Category.COMBAT) public class LostChickens extends AbstractScript { private Timer t = new Timer(); public int feathers; @Override public void onStart() { log("Welcome to a basic chicken killer"); log("We will kill chickens and pick up feathers"); } @SuppressWarnings("unused") private State state; private enum State{ Kill, Wait, Anti; } private State getState(){ if(getLocalPlayer().canAttack() && !getLocalPlayer().isInCombat() && !getLocalPlayer().isMoving()){ return State.Kill; } if(Calculations.random(234) == 1 && getLocalPlayer().isInCombat()) { return State.Anti; } else { return State.Wait; } } @Override public int onLoop() { switch (getState()) { case Kill: NPC chicken = getNpcs().closest("Chicken"); //Getting Chicken GroundItem feather = getGroundItems().closest("Feather"); //Getting Feather if(chicken != null && !chicken.isInCombat() && chicken.canAttack()) { chicken.interact("Attack"); getCamera().rotateToEntity(chicken); sleepUntil(new Condition(){ @Override public boolean verify(){ return chicken.getHealth() <= 0; } },Calculations.random(512)); } if(feather != null && feather.exists() && !getLocalPlayer().isMoving() && !chicken.isOnScreen() && !getLocalPlayer().isInCombat()) { feather.interact("Take"); feathers = getInventory().count("Feather"); } break; case Anti: int Anti1 = Calculations.random(3); switch(Anti1) { case 1: getTabs().open(Tab.STATS); sleep(Calculations.random(5000)); getTabs().open(Tab.INVENTORY); break; case 2: getMouse().moveMouseOutsideScreen(); break; case 3: getTabs().open(Tab.COMBAT); sleep(Calculations.random(5000)); getTabs().open(Tab.INVENTORY); } case Wait: sleep(Calculations.random(1240,3333)); break; } return Calculations.random(347); } @Override public void onExit() { } public void onPaint(Graphics2D g) { g.setColor(Color.WHITE); g.setFont(new Font("Arial", 1, 11)); g.drawString("Time Running: " + t.formatTime(), 25, 50); g.drawString("Feathers Picked up: " +feathers, 25, 60); } } also for those that have no idea what to do with that big scary thing above: https://dl.dropboxusercontent.com/u/141805798/LostChickens.jar Link to comment Share on other sites More sharing options...
BakonBitz 3 Share Posted March 4, 2016 Thanks mate for helping me learning to script! Duno if Voches are needed for this site (Still very used to rune-server) but i Vouch for this guy. Link to comment Share on other sites More sharing options...
Yato 0 Share Posted May 26, 2018 Does this support ranging? If not how would I get it to support ranging? (I realize the thread is super old) Link to comment Share on other sites More sharing options...
FissionChips 0 Share Posted July 25, 2018 @Yato The attack action doesn't care what you're wielding, so ranging is naturally supported. If you do decide to range you might want to consider modifying the script to also pick up ammo and equipt it. Link to comment Share on other sites More sharing options...
mecanos28 2 Share Posted March 25, 2020 thanks, this gave me ideas for my own script. appreciate you uploading it. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.