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
  • Aviansie Wilderness GWD Killer


    crezzy

    Recommended Posts

    (NOTE: Not sure if this is wrong section for projects but if s then please move it, thanks)

     

    Hello DreamBot community  :)

    So I've recently just come back to OSRS and you know how it is... bot bot bot lol! Anyway OT, I've stared making a script to kill the Aviansie within the Wilderness Godwars area and spent about 2-3 hours writing it so far; its not a lot but HOWEVER, one of the main reason I'm writing this is to learn the Dreambot API whilst learning a bit more Java(Not touched programming in over 3 years!). So I will be posting my source code here for people to give constructive criticism to help me eventually get better with the API. Also eventually you guys can have the script.jar file also for you who just want the script, not the code :) 

     

    Start:conditions:

    Player must have a amulet of glory with at-least two charges(Req'd to start script!). It will also be recommended to have a decent range weapon+bolts/arrows(DUH?) and have a Armadyl+Zamarok item equipped. Also a looting bag, prayer potions(15-20) and range potions(2) within their inventory.

     

    Basic script functionality:

    (WHILST IN WILD ALWAYS CHECK FOR PKERS AND TELEPORT IF SEEN;  END SCRIPT)

    1)Start by teleporting to Edge using a glory IF the player has a glory with 2 or more charges.

    2)Walk to wilderness ditch and cross over it

    3)Walk to Wilderness GWD cave entrance and enter it

    4)Interact with boulder and cross over it then enter the GWD area.

    5)Find a suitable Aviansie(combat levels 69, 71, 79, 81(lower levels to increase GP gain p/h)) to attack and attack it.

    6)IF there are addy bars, grimmy rannar, rune daggers, rune limbs or Aviansie heads on the floor then pick them up.

    7)IF player has grimmy rannar, rune daggers, rune limbs or Aviansie heads within their inventory then place them into the looting bag. 

    8)Drink a prayer potion when the player needs prayer points.

    9)Drink range potion if range level equals current_range_level plus 5.

    10)When player runs out of prayer potions teleport to edge using a glory.

    11)Got to bank and Deposit all inventory items(depositing looting bag contents also?).

    12)withdraw 20 prayer potions, 2 ranging potions and the looting bag.

    13)IF the player has items mention in above step restart script from step 2 ELSE end script.

     

    Well thats pretty much everything that the script will contain hopefully. I've only really got concerns about emptying the looting bag contents within the bank and figuring out if there's a Pking on the prowl but I'll try my best to work them out when I get to it.

     

    So far I've done 1-5 in the list above and would like so comments on if the code is bad, then why and how could I improve it :)

     

    (NOTE: I've done this in a Node based framework so there's no point me pasting Main.java)

     

    TaskFrame.java:

    package com;
    
    import org.dreambot.api.methods.MethodContext;
    import org.dreambot.api.methods.map.Area;
    import org.dreambot.api.methods.map.Tile;
    
    public abstract class TaskFrame {
    
    	protected MethodContext c;	 
    	
    	protected Area gwdArea() {
    		Area gwdArea = Area.generateArea(7, new Tile(3025, 10160));
    		return gwdArea;
    	}
    	
    	protected boolean atGWD() {		
    		return gwdArea() != null && gwdArea().contains(c.getLocalPlayer().getTile());
    	}
    	
    	public int priority () {
            return 0;
        }
    
    	
    	public TaskFrame(MethodContext context) {
    		this.c = context;
    	}
    	
    	public abstract boolean validate();
    	public abstract int execute();
    	
    }
    
    Walk.java
    
    package Tasks;
    
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.MethodContext;
    import org.dreambot.api.methods.container.impl.equipment.EquipmentSlot;
    import org.dreambot.api.methods.map.Tile;
    import org.dreambot.api.wrappers.interactive.NPC;
    
    import com.Main;
    import com.TaskFrame;
    
    public class Walk extends TaskFrame {
    
    	private int walkStage = 2;
    
    	public Walk(MethodContext c) {
    		super(c);
    	}
    
    	private boolean walkInteract(Tile tile, int objectID, String option) {
    		if (c.getLocalPlayer().getTile().distance(tile) > 5) {
    			c.getWalking().walk(tile);
    			MethodContext.sleepUntil(() -> c.getLocalPlayer().getTile().distance(tile) > 5,
    					Calculations.random(2500) + 3000);
    			return false;
    		} else {
    			c.getGameObjects().closest(objectID).interact(option);
    			walkStage++;
    			return true;
    		}
    	}
    
    	@Override
    	public boolean validate() {
    		return !atGWD();
    	}
    
    	@Override
    	public int priority() {
    		return 1;
    	}
    
    	@Override
    	public int execute() {
    		MethodContext
    				.log("Walk stage: " + walkStage + "  Player coords: X: " + c.getLocalPlayer().getTile().getX()
    						+ " Y: " + c.getLocalPlayer().getTile().getY() + " Z: " + c.getLocalPlayer().getTile().getZ());
    		switch (walkStage) {
    		case 0:
    			if (c.getEquipment().slotContains(EquipmentSlot.AMULET.getSlot(), "Amulet of glory(4)")
    					|| c.getEquipment().slotContains(EquipmentSlot.AMULET.getSlot(), "Amulet of glory(3)")
    					|| c.getEquipment().slotContains(EquipmentSlot.AMULET.getSlot(), "Amulet of glory(2)")) {
    				MethodContext.log("Player has glory; Teleporting to Edgeville!");
    				c.getEquipment().open();
    				MethodContext.sleepUntil(() -> c.getEquipment().open(), Calculations.random(7500) + 5000);
    				c.getEquipment().getItemInSlot(EquipmentSlot.AMULET.getSlot()).interact("Edgeville");
    				walkStage++;
    			} else {
    				Main.log("Need amulet of glory with atleast 2 charges equiped to start!");
    			}
    			break;
    		case 1:
    			Main.log("Walking to wilderness ditch");
    			walkInteract(new Tile(3089, 3521, 0), 23271, "cross");
    			break;
    		case 2:
    			Main.log("Walking to gwd entrance!");
    			walkInteract(new Tile(3016, 3738, 0), 26766, "Enter");
    			break;
    		case 3:
    			Main.log("walking to boulder");
    			Tile nextToBoulderTile = new Tile(3055, 10165, 3);
    			c.getWalking().walk(nextToBoulderTile);
    			MethodContext.sleepUntil(() -> c.getLocalPlayer().getTile().distance(nextToBoulderTile) >= 1,
    					Calculations.random(2500) + 1000);
    			if (c.getLocalPlayer().getTile().distance(new Tile(3055, 10165, 3)) <= 1) {
    				walkStage++;
    			}
    			break;
    		case 4:
    			NPC boulder = c.getNpcs().closest(6621);
    			if (boulder != null && boulder.isOnScreen() && boulder.interactForceLeft("Move")) {
    				Main.log("interacting(moving) with boulder");
    				MethodContext.sleep(4000, 5000);
    				walkStage++;
    			}
    			break;
    		case 5:
    			Main.log("interacting with crevice -> Enter gwd!");
    			c.getGameObjects().closest(26767).interactForceLeft("Use");
    			walkStage++;
    			break;
    		case 6:
    			c.getWalking().walk(new Tile(3026, 10163));
    			break;
    		}
    		return Calculations.random(500, 2000);
    	}
    }
    
    

    Attack.java

    package Tasks;
    
    import org.dreambot.api.methods.Calculations;
    import org.dreambot.api.methods.MethodContext;
    import org.dreambot.api.wrappers.interactive.NPC;
    
    import com.TaskFrame;
    
    public class Attack extends TaskFrame {
    
    	private NPC avToAttack;
    	private boolean inCombat = false;
    
    	public Attack(MethodContext context) {
    		super(context);
    	}
    
    	@Override
    	public boolean validate() {
    		return c.getLocalPlayer().canAttack() && atGWD();
    	}
    
    	@Override
    	public int execute() {
    		int aviansieID[] = { 3169, 3177, 3181, 3179 };
    		NPC attackbleAvs[] = new NPC[aviansieID.length];
    		for (int i = 0; i < aviansieID.length; i++) {
    			attackbleAvs[i] = c.getNpcs().closest(aviansieID[i]);
    		}
    		avToAttack = attackbleAvs[Calculations.random(4)];
    		inCombat = avToAttack != null && avToAttack.isOnScreen() && !avToAttack.isInCombat()
    				&& avToAttack.interactForceLeft("Attack");
    		MethodContext.sleepUntil(() -> !inCombat, Calculations.random(1500) + 3000);
    		return 1159;
    	}
    
    }
    
    
    Link to comment
    Share on other sites

    As far as I know, the models for aviansies are broken, so you may or may not have to change the way you do the interactions with them.

    Link to comment
    Share on other sites

    As far as I know, the models for aviansies are broken, so you may or may not have to change the way you do the interactions with them.

    Ok, thanks for letting me know! :) 

    Link to comment
    Share on other sites

    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.