Kirito 5 Posted December 3, 2016 so i'm making a script for item collecting but the game object has 2 items that you can collect but if i use the regular GameObject name then it spam clicks it even if there are no items on it. how would i make it collect the items untill there are no more and change GameObject or swap world?
Soldtodie 76 Posted December 3, 2016 You could get the gameobject\grounditem and check it with .exists() or you just get all gameobjects/grounditems and check if the object/item exists in the list/array.
Kirito 5 Author Posted December 3, 2016 You could get the gameobject\grounditem and check it with .exists() or you just get all gameobjects/grounditems and check if the object/item exists in the list/array. ok so i currently have this private State getState() { GameObject tree = getGameObjects().closest("Banana Tree"); if (getInventory().isFull()) return State.BANK; if (tree != null) return State.PICK; return State.WAIT; } public void onExit() { log("Thank you for using Banana Picker by Kirito."); } @Override public int onLoop() { switch (getState()) { case PICK: GameObject tree = getGameObjects().closest("Panana Tree"); if (tree != null && getLocalPlayer().isStandingStill()) { log("Status: Picking all Banana's"); tree.interact("Pick-from"); //return Calculations.random(500, 600); }
Soldtodie 76 Posted December 3, 2016 Panana != Banana The Banana tree should have a different model id if the Bananas are picked. You could check for that or if the action pick-from is available.
Kirito 5 Author Posted December 3, 2016 Panana != Banana The Banana tree should have a different model id if the Bananas are picked. You could check for that or if the action pick-from is available. the banana tree was just an example so i tried it with red berry bush's but there the pick option stays up for some reason and then it keeps spam clicking that single bush even tough the berries are not there got this now GameObject bush = getGameObjects().closest(cadava -> cadava.getID() == 23625); but now i need to be able to add multiple ids
slasso 27 Posted December 3, 2016 Well I'm not sure if you can obtain how many are items are left on the tree/plant but all bushes have 3 berries, I think all fruit trees are 6 fruit. So you can count how many you pick and stop picking once you reach that number.
Kirito 5 Author Posted December 3, 2016 Well I'm not sure if you can obtain how many are items are left on the tree/plant but all bushes have 3 berries, I think all fruit trees are 6 fruit. So you can count how many you pick and stop picking once you reach that number. every fruit you pick makes the bush/tree id change by 1 for example cadava berries = id 23625 when having 2 berries 1 berry picked = 23626 all berries picked = 23627. the problem is when the bot picks 1 fruit the GameObject id changes wich results in not picking fruits anymore.
slasso 27 Posted December 3, 2016 every fruit you pick makes the bush/tree id change by 1 for example cadava berries = id 23625 when having 2 berries 1 berry picked = 23626 all berries picked = 23627. the problem is when the bot picks 1 fruit the GameObject id changes wich results in not picking fruits anymore. Oh, then do this. GameObject bushWithBerries = getGameObjects().closest(cadava -> cadava.getID() == 23625 || cadava.getID() == 23626 || cadava.getID() == idWhenNoBerriesArePicked);
Recommended Posts
Archived
This topic is now archived and is closed to further replies.