jeremy4444 Posted March 17, 2015 Share Posted March 17, 2015 I know what I'm doing wrong but I don't know the solution. player.isInCombat doesn't work. Could I do: else(player.isInCombat()) { Wait until player is out of combat } I'm not familiar with the API and I'm not really sure how I go about finding the bits and pieces I need for my script. The API website page is really confusing and hard to find exactly what I "think" I'm looking for. @Override public int onLoop() { NPC manWoman = npcs.closest("Man", "Woman"); if(manWoman != null){ manWoman.interact("Attack"); } return 100; } Quote Link to comment Share on other sites More sharing options...
Twin Posted March 17, 2015 Share Posted March 17, 2015 (edited) Just do if(manWoman!=null&&!myPlayer().isUnderAttack) blahblahblah; this will make it so it won't search for another man unless you're out of combat Edited March 17, 2015 by twin 763 Quote Link to comment Share on other sites More sharing options...
jeremy4444 Posted March 17, 2015 Author Share Posted March 17, 2015 (edited) I will try that... Edited March 17, 2015 by jeremy4444 Quote Link to comment Share on other sites More sharing options...
Twin Posted March 17, 2015 Share Posted March 17, 2015 I will try that...This is what I came up with: if(players.getCombat() != null) Thread.sleep(1500, 2000); return 100; I would just use !myPlayer().isUnderAttack, because that will kind of sleep it from interacting with men until its out of combat. Quote Link to comment Share on other sites More sharing options...
jeremy4444 Posted March 17, 2015 Author Share Posted March 17, 2015 (edited) Thank you, it works, I'm going to change Return to 1500msec because it's spam clicking them. Also, they're inside a building, sometimes outside, I need something like: If(manWoman.isUnreachable && doorObject.isClosed) open door; If you know any good tutorials for complete beginners, I will definitely read them. I feel bad for basically asking you to make this script for me. Edited March 17, 2015 by jeremy4444 Quote Link to comment Share on other sites More sharing options...
Twin Posted March 17, 2015 Share Posted March 17, 2015 (edited) Thank you, it works, I'm going to change Return to 1500msec because it's spam clicking them. Also, they're inside a building, sometimes outside, I need something like: If(manWoman.isUnreachable && doorObject.isClosed) open door; If you know any good tutorials for complete beginners, I will definitely read them. I feel bad for basically asking you to make this script for me. Did you use the ! In front of myPlayer? ! Means not or the opposite of what you're saying. If(!inventory.isFull()) means if inventory is not full. And you can just have the bot open the door every time it's closed to make things easier. If(door.contains("Open") door.interact("Open"); If you want to get more advanced you can override messageListener, and say whenever "I can't reach this" shows up in chat, open the door. Then you can also do a minimap check Which I'm not to sure how to do, because I've never used it. Or you can just set an area that doesn't contain what's outside of the door and say like If(!MANWOMANAREA.contains(manWoman)) manWoman.interact("Attack"); Edited March 17, 2015 by twin 763 Quote Link to comment Share on other sites More sharing options...
Lemons Posted March 17, 2015 Share Posted March 17, 2015 (edited) if (map.canReach(manWoman)) { Will test if you can reach the man, finding the door in the way is a bit harder. You can use a method similar to what Twin suggested for a simple fix, but it could pick the wrong door potentially. Edited March 17, 2015 by dudeami Quote Link to comment Share on other sites More sharing options...
Twin Posted March 17, 2015 Share Posted March 17, 2015 if (map.canReach(manWoman)) {Will test if you can reach the man, finding the door in the way is a bit harder. You can use a method similar to what Twin suggested for a simple fix, but it could pick the wrong door potentially.This was the minimap way I was talking about. Couldnt remember it off the top of my head. Quote Link to comment Share on other sites More sharing options...