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
  • F2P Cow killer/hide collector [Source code]


    fractal

    Recommended Posts

    Posted

    Hi eveyone,

    thought I would share my cow killer script. It takes breaks between actions, with times from a gamma distribution whose shape is defined by the action type. It collects hides and banks when inventory is full. It also opens that pesky gate if trying to attack a cow outside the pen. It doesn't cook meat or eat or care about health, so kill a few chickens or goblins first before botting on a new account (the script can be edited to include a different area/different target NPC/different loot). Remember to bot responsibly, and let me know if you have any problems or suggestions!

    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.methods.map.Tile;
    import org.dreambot.api.script.AbstractScript;
    import org.dreambot.api.script.Category;
    import org.dreambot.api.script.ScriptManifest;
    import org.dreambot.api.wrappers.interactive.GameObject;
    import org.dreambot.api.wrappers.interactive.NPC;
    import org.dreambot.api.wrappers.items.GroundItem;
    
    @ScriptManifest(author = "fractal", name = "FractalCowKiller", category = Category.COMBAT, version = 1.0, description = "Kills cows, loots their hides, and banks")
    
    public class CowKiller extends AbstractScript {
    
        public enum actionTypes {
            walking, interactive, spam, afk
        }
    
        int walkingShape;
        int runningShape;
        int interactiveShape;
        int spamShape;
        int scale;
        int reaction;   // minimum wait between actions
        int patience;   // minimum wait between running to a new spot while still running. patience is doubled while walking
        int latency = 250;  // how long does it take the game to register your actions? change this depending on CPU/RAM/lag
        Area cowPen = new Area(new Tile(3265, 3296), new Tile(3253, 3255));
        int cowHide = 1739;
        int gate = 1558;
    
        @Override
        public int onLoop() {
            farmHides();
            return 0;
        }
    
        public void onStart(){
            reaction = Calculations.random(200,400);
            patience = Calculations.random(1500, 3000);
            walkingShape = Calculations.random(2,5);
            runningShape = Calculations.random(2,4);
            interactiveShape = Calculations.random(2,4);
            spamShape = 1;
            scale = Calculations.random(400,1000);  // proxy for variables in your physical environment affecting your attention
        }
    
        public int farmHides() {
            String[] targets = {"Cow", "Cow calf"};
            Integer[] loot = {cowHide};
            if (getInventory().isFull()) {
                bankItems(loot, false);
            } else {
                combatLoot(targets, loot, cowPen);
            }
            return 1;
        }
    
        public void combatLoot(String[] targets, Integer[] loot, Area area) {
            if (!area.contains(getLocalPlayer())) {
                go(area);
            } else if (!getLocalPlayer().isInCombat()){
                NPC target = getNpcs().closest(t -> t!= null && !t.isInCombat() && elem(t.getName(), targets));
                GroundItem prize = getGroundItems().closest(loot);
                if (prize != null && target != null && prize.distance(getLocalPlayer()) < target.distance(getLocalPlayer())) {
                    prize.interact("Take");
                    sleep(latency);
                    sleepUntil(()-> !getLocalPlayer().isMoving(), 60000);
                    antiban(actionTypes.interactive);
                } else if (target != null && !getLocalPlayer().isInCombat()) {
                    GameObject g = getGameObjects().closest(o -> o.getID() == gate);
                    if (!area.contains(target) && g.hasAction("Open")) {
                            g.interact("Open");
                    } else if (target.interact("Attack")) {
                        sleepUntil(() -> getLocalPlayer().isInCombat(), 60000);
                        sleepUntil(() -> !getLocalPlayer().isInCombat(), 60000);
                    }
                    antiban(actionTypes.interactive);
                }
            } else {
                sleepUntil(() -> !getLocalPlayer().isInCombat(), 60000);
            }
        }
    
        public void bankItems(Integer[] itemIDs, boolean all) {
            if (!getBank().isOpen()) {
                getBank().open(getBank().getClosestBankLocation());
                antiban(actionTypes.interactive);
            } else {
                if (all) {
                    getBank().depositAllItems();
                    antiban(actionTypes.interactive);
                    getBank().close();
                    antiban(actionTypes.interactive);
                } else {
                    getBank().depositAll(item -> elem(item.getID(), itemIDs));
                    antiban(actionTypes.interactive);
                    getBank().close();
                    antiban(actionTypes.interactive);
                }
            }
        }
    
        public boolean elem (Object elem, Object[] list){
            for (int i = 0; i < list.length; i++){
                if (list[i].equals(elem)){
                    return true;
                }
            }
            return false;
        }
    
        public void go(Area area) {
            if (!area.contains(getLocalPlayer())) {
                getWalking().walk(area.getRandomTile());
                antiban(actionTypes.walking);
            }
        }
    
        public void antiban(actionTypes action) {
            if (action == actionTypes.walking) {
                if(getWalking().isRunEnabled()) {
                    int time = (int) (Calculations.nextGammaRandom(runningShape, scale)) + patience;
                    sleep(latency);
                    sleepUntil(() -> !getLocalPlayer().isMoving(), time);
                } else {
                    int time = (int) (Calculations.nextGammaRandom(walkingShape, scale)) + patience * 2;
                    sleep(latency);
                    sleepUntil(() -> !getLocalPlayer().isMoving(), time);
                }
            } else if (action == actionTypes.interactive) {
                int time = (int) (Calculations.nextGammaRandom(interactiveShape, scale)) + reaction;
                sleep(time);
            } else if (action == actionTypes.spam){
                int time = (int) (Calculations.nextGammaRandom(spamShape, scale)) + reaction;
                sleep(time);
            }
        }
    }

     

    • 2 months later...
    Posted
    On 10/24/2019 at 5:21 AM, fractal said:

    Hi eveyone,

    thought I would share my cow killer script. It takes breaks between actions, with times from a gamma distribution whose shape is defined by the action type. It collects hides and banks when inventory is full. It also opens that pesky gate if trying to attack a cow outside the pen. It doesn't cook meat or eat or care about health, so kill a few chickens or goblins first before boting on a new account (the script can be edited to include a different area/different target NPC/different loot). Remember to bot responsibly, and let me know if you have any problems or suggestions!

    Thank you for posting this. Sorry you didn't get an immediate response from other members but i'm sure the community appreciates it.

    • 1 month later...
    • 1 month later...
    Posted

    hi! i was wondering.. can u compile that .txt in .jar 4 me pls? 😢

    • 3 months later...
    Posted

    I think his set latency at 250 is what jagex looks for in a bot to ban....kind of a giveaway, how can you get rid of it and have the game still not smoothly?

    • 4 weeks later...
    Posted

    I used this code and got banned shortly after. Specially since a lot of people are using this code, and cows are bot hotspot area.

    Tis life.

    But thanks for providing this.

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.