DontGetBanned 3 Posted February 10, 2020 cant seem to get my looting method down... when NPC is killed, the script will either find a new target before looting, or loot. When it does loot, it tends to pick up the first item and not the item i want looted. example: Kill a cow, instead of looting the cowhide it would loot the raw meat even though i dont have raw meat anywhere mentioned in the code and it carrys on with finding a new target and attacking that. i think i have something wrong with this bit of code private final static String[] Loot = {"Cow hide", "Bone"}; private final String Take = "Take"; private void Loot() { if(getGroundItems().closest(Loot) != null ) { getGroundItems().closest(LootFilter).interact(Take); } sleep(Calculations.random(1000,5000)); } if someone can help correct me on this, to make it loot the list of Loot im not using this for killing cows, but this an example im using
DontGetBanned 3 Author Posted February 13, 2020 On 2/9/2020 at 6:44 PM, BANME said: where is LootFilter ? private void Loot() { if(getGroundItems().equals(Loot)) { getGroundItems().all(LootFilter);//.interact(Take); sleep(Calculations.random(1000,2000)); } GameState = State.WAIT; } public static final Filter<GroundItem> LootFilter = new Filter<GroundItem>() { @Override public boolean match(GroundItem grounditem) { if(grounditem == null) { return false; } if(grounditem.getName().equals(Loot)) { return true; } return false; } };
Recommended Posts
Archived
This topic is now archived and is closed to further replies.