April 24, 20169 yr I am trying to walk to an entity if it is not visible. My scripts cuts the trees but then just stands there and does nothing... This is my code so far: Entity tree = sI.objects.closest("Tree"); if (!sI.inventory.isFull() && tree != null) { if (tree.isVisible()) { if (!sI.myPlayer().isMoving() && !sI.myPlayer().isAnimating()) { tree.interact("Chop down"); sleep(random(400, 800)); } else if (tree != null && !tree.isVisible()){ // Walk to tree sleep(random(400, 1000)); } } } }
April 24, 20169 yr if (tree != null) { if (tree.isVisible()) { if (!myPlayer().isAnimating() && !myPlayer().isMoving()) { if (tree.interact("Chop down")) { return 1000; } } } else { if (myPlayer().getPosition().distance(tree) <= 9) { getCamera().toEntity(tree); } else { getWalking().walk(tree); } } } Edited April 24, 20169 yr by iJodix
April 24, 20169 yr Author if (tree != null) { if (tree.isVisible()) { if (!myPlayer().isAnimating() && !myPlayer().isMoving()) { if (tree.interact("Chop down")) { return 1000; } } } else { if (myPlayer().getPosition().distance(tree) <= 9) { getCamera().toEntity(tree); } else { getWalking().walk(tree); } } } I changed it to this, but when I start the script it still stands there - if I pause the script and move myself it starts chopping but then it just stands still again. Is this correct? Entity tree = sI.objects.closest("Tree");
April 24, 20169 yr I changed it to this, but when I start the script it still stands there - if I pause the script and move myself it starts chopping but then it just stands still again. Is this correct? Entity tree = sI.objects.closest("Tree"); Just do; RS2Object tree = getObjects().closest("Tree");
April 24, 20169 yr Author I got it working now, it was something to do with my Tree Area. Thanks for your help.
April 24, 20169 yr I changed it to this, but when I start the script it still stands there - if I pause the script and move myself it starts chopping but then it just stands still again. Is this correct? Entity tree = sI.objects.closest("Tree"); Just do; RS2Object tree = getObjects().closest("Tree"); http://osbot.org/forum/topic/93981-guidetypes-of-entities-and-how-to-use-them-correctly/ this might help too, its a guide about entity types :P
Create an account or sign in to comment