March 27, 20178 yr 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.
March 27, 20178 yr Author 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.
March 27, 20178 yr 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");
March 27, 20178 yr Author 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.
March 27, 20178 yr Entity ent = npcs.closest("chickennub"); if (ent!=null) { ent.interact("Attack"); }
March 27, 20178 yr 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, 20178 yr by Explv
March 27, 20178 yr Author 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, 20178 yr by Booleans YAY quoting explv
March 27, 20178 yr 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
March 27, 20178 yr Author 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.
March 27, 20178 yr 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?
March 27, 20178 yr 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
Create an account or sign in to comment