June 26, 20187 yr 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(); }
June 26, 20187 yr Just check for how long your player hasn't been in combat for, if it's greater than like 20 seconds reset agro.
June 26, 20187 yr 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, 20187 yr by PureKiller
June 26, 20187 yr iirc the sand crabs have a different name when they're not Agro'd, I believe it's sandy rock or something?
June 27, 20187 yr 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, 20187 yr by cammofunk
June 27, 20187 yr Author 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(); } }
Create an account or sign in to comment