September 19, 201510 yr 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?
September 19, 201510 yr you could try if(!myPlayer().isUnderAttack && !myPlayer.isAnimating()) //kock out else //sleep(random(x,y)) Edited September 19, 201510 yr by Muffins
September 19, 201510 yr Author 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, 201510 yr by elemt
September 19, 201510 yr 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
September 19, 201510 yr 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, 201510 yr by Tom
September 19, 201510 yr 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,
Create an account or sign in to comment