elemt Posted September 19, 2015 Share Posted September 19, 2015 I'm trying to make a script for blackjacking menaphite thugs. After I create an npc object, I need to do npc.interact("Knock-out"). The problem is that the knock-out can fail. How can I detect when I have successfully knocked out the NPC and when I need to atempt knock-out again? Quote Link to comment Share on other sites More sharing options...
Muffins Posted September 19, 2015 Share Posted September 19, 2015 (edited) you could try if(!myPlayer().isUnderAttack && !myPlayer.isAnimating()) //kock out else //sleep(random(x,y)) Edited September 19, 2015 by Muffins Quote Link to comment Share on other sites More sharing options...
elemt Posted September 19, 2015 Author Share Posted September 19, 2015 (edited) you could try if(!myPlayer().isUnderAttack) //kock out else //sleep I'll try that. Another thing I was thinking of was checking my player's HP before and after the knockout. How do I get my player's HP with this API? I'm new at OSBot. Edited September 19, 2015 by elemt Quote Link to comment Share on other sites More sharing options...
Muffins Posted September 19, 2015 Share Posted September 19, 2015 I'll try that. Another think I was thinking of was checking my players HP before and after the knockout. How do I get my players HP with this API? I'm new at OSBot. it is...... this.getSkills().getDynamic(Skill.HITPOINTS) < X) X = Hitpoints you wish to set it at 1 Quote Link to comment Share on other sites More sharing options...
elemt Posted September 19, 2015 Author Share Posted September 19, 2015 Thank you 1 Quote Link to comment Share on other sites More sharing options...
Tom Posted September 19, 2015 Share Posted September 19, 2015 (edited) Thank you I would also suggest getting straight into Conditional Sleeps, which is basically sleeping until a condition is true (prevents over sleeping, etc) new ConditionSleep(2000){ // 2000 is the time out, so it will sleep for a max of 2 seconds @Override public boolean condition(){ return !myPlayer().isUnderAttack() && !myPlayer.isAnimating(); } }.sleep(); Its a bit longer than a regular sleep, but considered better in terms of antiban in the long run and script efficiency/effectiveness. Edited September 19, 2015 by Tom Quote Link to comment Share on other sites More sharing options...
Bobrocket Posted September 19, 2015 Share Posted September 19, 2015 Lads, you're giving him all the wrong information, he's asking for how he can detect if the NPC is knocked out. When the thug is knocked out, the height will decrease. Log npc#getHeight() before and after you attempt to knockout, 1 Quote Link to comment Share on other sites More sharing options...