iTalalz Posted June 26, 2018 Share Posted June 26, 2018 heyy, i was wondering if someone could help me with this not sure how exactly to check when sand crabs have lost agro. when they are in the state where we can not attack them this is the code i am currently using and it does not work if (sandCrab != null && sandCrab.exists() && !sandCrab.hasAction("Attack")) { log("agro reset"); resetAgro(); } Quote Link to comment Share on other sites More sharing options...
d0zza Posted June 26, 2018 Share Posted June 26, 2018 Just check for how long your player hasn't been in combat for, if it's greater than like 20 seconds reset agro. 1 Quote Link to comment Share on other sites More sharing options...
PureKiller Posted June 26, 2018 Share Posted June 26, 2018 (edited) if (myPlayer().isUnderAttack()) { lastAttack = System.currentTimeMillis(); //KEEP AFKING } else if (System.currentTimeMillis() > (lastAttack + resetTime) && !myPlayer().isUnderAttack()) { //RESET PLAYER } Reset time is the amount of time the player should not be in combat in milliseconds, which indicates whether we are still aggro or not. In your case, I suggest putting it at around 20000 milliseconds = 20 seconds. Edited June 26, 2018 by PureKiller 2 Quote Link to comment Share on other sites More sharing options...
Hel Posted June 26, 2018 Share Posted June 26, 2018 iirc the sand crabs have a different name when they're not Agro'd, I believe it's sandy rock or something? 1 Quote Link to comment Share on other sites More sharing options...
cammofunk Posted June 27, 2018 Share Posted June 27, 2018 (edited) ya search combat area for sandy rocks, if they're present for longer than 5-20 secs reset. thats my approach. something like if(sandyRocksInArea && playerOnCombatTile && !myPlayerInCombat) { startCustomTimer(); }else{ resetCustomTimer(); } if(timer>random(5000,20000)) { reset(); } Edited June 27, 2018 by cammofunk 1 Quote Link to comment Share on other sites More sharing options...
iTalalz Posted June 27, 2018 Author Share Posted June 27, 2018 Thanks for the help guys. I ended up going with Slut's method. As I didn't wanna use a timer. And that was my problem basically, I was treating both, sand crabs and sandy rocks as the same. On 6/25/2018 at 7:06 PM, Slut said: iirc the sand crabs have a different name when they're not Agro'd, I believe it's sandy rock or something? So far its working good. If anyone else wants to use it, feel free. if (!getCombat().isFighting() && sandyRocks != null && sandyRocks.exists() && (sandCrab == null || !sandCrab.exists()) ) { sleep(random(1000, 5000)); if (npcs.closest(myArea, "Sand Crab") == null) { log("reseting agro"); resetAgro(); } } 1 Quote Link to comment Share on other sites More sharing options...