DontGetBanned 3 Share 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 Link to comment Share on other sites More sharing options...
BANME 5 Share Posted February 10, 2020 where is LootFilter ? Link to comment Share on other sites More sharing options...
DontGetBanned 3 Author Share 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; } }; Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now