Booleans YAY Posted March 27, 2017 Share Posted March 27, 2017 I tried the interaction(attack) way but didn't work. Not too sure the correct usage is for this. If someone can give me the usage or API link so I can actually figure it out for NPC specified. Quote Link to comment Share on other sites More sharing options...
Chris Posted March 27, 2017 Share Posted March 27, 2017 npc.interact("Attack"); ? Quote Link to comment Share on other sites More sharing options...
Booleans YAY Posted March 27, 2017 Author Share Posted March 27, 2017 2 minutes ago, Chris said: npc.interact("Attack"); ? I said the interactions didn't work. I made over 14 scripts but never really combat related so I dont know what's going on or what to specificly conclude in writing a combat script for this situation. Quote Link to comment Share on other sites More sharing options...
Chris Posted March 27, 2017 Share Posted March 27, 2017 1 minute ago, Booleans YAY said: I said the interactions didn't work. I made over 14 scripts but never really combat related so I dont know what's going on or what to specificly conclude in writing a combat script for this situation. it should work? unless ur doing something wrong Npc cow = getNpcs().closest("Cow"): if (cow != null) cow.interact("Attack"); Quote Link to comment Share on other sites More sharing options...
Booleans YAY Posted March 27, 2017 Author Share Posted March 27, 2017 1 hour ago, Chris said: it should work? unless ur doing something wrong Npc cow = getNpcs().closest("Cow"): if (cow != null) cow.interact("Attack"); NPC chicken = getNpcs().closest(2820); if (chicken != null && chicken.isAttackable()) { chicken.interact("Attack"); } the chicken id is same relevancy use as the name itself, I tried both name and ID. also everything you see there was tried with and without pieces being shown. Quote Link to comment Share on other sites More sharing options...
Juggles Posted March 27, 2017 Share Posted March 27, 2017 Entity ent = npcs.closest("chickennub"); if (ent!=null) { ent.interact("Attack"); } Quote Link to comment Share on other sites More sharing options...
Polymorphism Posted March 27, 2017 Share Posted March 27, 2017 Add my skype and i'll help 1 on 1 skype: polycoding Quote Link to comment Share on other sites More sharing options...
Explv Posted March 27, 2017 Share Posted March 27, 2017 (edited) 8 hours ago, Booleans YAY said: NPC chicken = getNpcs().closest(2820); if (chicken != null && chicken.isAttackable()) { chicken.interact("Attack"); } the chicken id is same relevancy use as the name itself, I tried both name and ID. also everything you see there was tried with and without pieces being shown. What if the closest chicken is not attackable? Your script will just sit there and do nothing. It should be something more like: NPC chicken = getNpcs().closest(npc -> npc.getName().equals("Chicken") && npc.isAttackable()); if (chicken != null && chicken.interact("Attack")) { new ConditionalSleep(5000) { @Override public boolean condition() { return !chicken.isAttackable() || myPlayer().isInteracting(chicken); } }.sleep(); } If that doesn't work it is something else in your script that is broken. Edited March 27, 2017 by Explv 1 Quote Link to comment Share on other sites More sharing options...
Booleans YAY Posted March 27, 2017 Author Share Posted March 27, 2017 (edited) I had the right code (besides the conditional sleeper) just my botstate enum check wasn't properly set to what it needed to be, fixed it though. Thanks for inputs, i'm sure this'll help more people than just myself in future. 3 hours ago, Explv said: What if the closest chicken is not attackable? Your script will just sit there and do nothing. It should be something more like: NPC chicken = getNpcs().closest(npc -> npc.getName().equals("Chicken") && npc.isAttackable()); if (chicken != null && chicken.interact("Attack")) { new ConditionalSleep(5000) { @Override public boolean condition() { return !chicken.isAttackable() || myPlayer().isInteracting(chicken); } }.sleep(); } If that doesn't work it is something else in your script that is broken. Should be this instead cause yours will attack multiple npcs at once within seconds timed. if (!myPlayer().isUnderAttack() && chicken != null && chicken.interact("Attack")) { Edited March 27, 2017 by Booleans YAY quoting explv Quote Link to comment Share on other sites More sharing options...
Explv Posted March 27, 2017 Share Posted March 27, 2017 1 hour ago, Booleans YAY said: I had the right code (besides the conditional sleeper) just my botstate enum check wasn't properly set to what it needed to be, fixed it though. Thanks for inputs, i'm sure this'll help more people than just myself in future. Should be this instead cause yours will attack multiple npcs at once within seconds timed. if (!myPlayer().isUnderAttack() && chicken != null && chicken.interact("Attack")) { Well yes, obviously you will need to check your player isn't already attacking a chicken. I just didn't think it was necessary to write out the entire script Quote Link to comment Share on other sites More sharing options...
Booleans YAY Posted March 27, 2017 Author Share Posted March 27, 2017 2 minutes ago, Explv said: Well yes, obviously you will need to check your player isn't already attacking a chicken. I just didn't think it was necessary to write out the entire script Well I mean you did write out all of that but not include a few key strokes in the if statement, regardless minor miss oh well. Appreciated the support. Quote Link to comment Share on other sites More sharing options...
Explv Posted March 27, 2017 Share Posted March 27, 2017 2 minutes ago, Booleans YAY said: Well I mean you did write out all of that but not include a few key strokes in the if statement, regardless minor miss oh well. Appreciated the support. Doesn't make sense to put it in the if statement though. It should be before you retrieve the closest chicken. Why look for a chicken if you aren't going to attack it? Quote Link to comment Share on other sites More sharing options...
Hayase Posted March 27, 2017 Share Posted March 27, 2017 39 minutes ago, Explv said: Doesn't make sense to put it in the if statement though. It should be before you retrieve the closest chicken. Why look for a chicken if you aren't going to attack it? cuz he uses booleans 2 attak chickenz bruh. First u gots 2 look 4 em den boolean em in closer cuz tis faster den filterz u kno? boolenz bro dey r the futere. sry boolean but he gave you a snippet to help get you in a good direction, you don't have to follow it if you don't want but ya Quote Link to comment Share on other sites More sharing options...