gkuracz 1 Posted July 25, 2016 I'm trying to make a fishing script but I can't manage to make it find the object in the area this is what i've done: fishToCatch = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().equals("Fishing spot") && gameObject.distance() < 20 && fishArea.contains(gameObject)); switch (getState()) { case FISH: if (fishArea.contains(getLocalPlayer())) { // IT GETS HERE if (fishToCatch != null && fishArea.contains(fishToCatch)) { // FAILS TO GET HERE, I SUPPOSE I'M NOT GETTING THE RIGHT GAMEOBJECT if (fishToCatch.isOnScreen()) { fish(); } else { move(); // move the camera a bit } } }else { if (getWalking().walk(fishAreaStart.getRandomTile())) { log("walking to fish area"); sleepUntil(() -> (getClient().getDestination().distance() < Calculations.random(6, 9))|| getLocalPlayer().isStandingStill(), Calculations.random(4100, 5110)); } } } private void fish() { if (fishToCatch != null && fishToCatch.interact("Net")) { log("Fishing."); sleep(Calculations.random(599, 1001)); // 600 1200 sleepUntil(() -> !getLocalPlayer().isMoving(),Calculations.random(2501, 4499)); // 3500 // 5000 sleep(Calculations.random(150, 311)); if (getLocalPlayer().isAnimating()) { antiBan(); sleepUntil(() -> !getLocalPlayer().isAnimating(), Calculations.random(7000, 12000)); } } }
JoieDeVivre 33 Posted July 25, 2016 I'm trying to make a fishing script but I can't manage to make it find the object in the area this is what i've done: fishToCatch = getNpcs().closest(gameObject -> gameObject != null && gameObject.getName().equals("Fishing spot") && gameObject.distance() < 20 && fishArea.contains(gameObject)); Use getNpcs() instead
Hopewelljnj 46 Posted July 25, 2016 Use getNpcs() instead Tho you should call it npc not gameobject to make your head understand it better
gkuracz 1 Author Posted July 26, 2016 Mind blown, thanks! I'll keep you guys posted. It worked like a charm! Awesome.
Diddy 265 Posted July 26, 2016 Mind blown, thanks! I'll keep you guys posted. It worked like a charm! Awesome. kinda rude to think that fish are objects, I bet nemo is sad now
Recommended Posts
Archived
This topic is now archived and is closed to further replies.