March 17, 201511 yr 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; }
March 17, 201511 yr 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, 201511 yr by twin 763
March 17, 201511 yr 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.
March 17, 201511 yr Author 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, 201511 yr by jeremy4444
March 17, 201511 yr 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, 201511 yr by twin 763
March 17, 201511 yr 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, 201511 yr by dudeami
March 17, 201511 yr 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.
Create an account or sign in to comment