Chris Posted July 23, 2015 Posted July 23, 2015 import org.osbot.rs07.api.model.NPC; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import javax.swing.text.Position; import java.awt.*; @ScriptManifest(author = "Sinatra", info = "", name = "Kil", version = 0.1, logo = "") public class Skeleton extends Script { @Override public void onStart() { /*code that will run*/ log("Welcome -- Starting the mothafukin script!"); } @Override public int onLoop() throws InterruptedException { final NPC Cow = this.npcs.closest("Cow", "Cow calf"); if(!this.myPlayer().isUnderAttack() && this.myPlayer().getInteracting() == null && Cow != null && Cow.isVisible()) { Cow.interact("Attack "); sleep(random(300, 600)); } else { camera.toEntity(Cow); sleep(random(300, 600)); } return (random(100,300)); } @Override public void onExit() { log("Thank you for testing my script!"); log("Let me know if you run in to problems!"); } @Override public void onPaint(Graphics2D g) { } The script runs! But how do I make it not attack other peoples cows? It keeps spam clicking! sorry I am new
Tom Posted July 23, 2015 Posted July 23, 2015 There should be an isUnderAttack method for the cow as well 1
Chris Posted July 23, 2015 Author Posted July 23, 2015 There should be an isUnderAttack method for the cow as well thanks for the helpful information!
Tom Posted July 23, 2015 Posted July 23, 2015 !cow.isUnderAttack && !cow.isAnimating The cows tend to roam around a bit, so isAnimating might lose a lot of script effectiveness
Gold Scripts Posted July 23, 2015 Posted July 23, 2015 (edited) The cows tend to roam around a bit, so isAnimating might lose a lot of script effectiveness That is true, but cows also will be animating while they are under attack. So it also helps filter out cows that are being attacked. But I do agree that script effectiveness could be lost Edited July 23, 2015 by OG Scripts
Tom Posted July 23, 2015 Posted July 23, 2015 (edited) That is true, but cows also will be animating while they are under attack. So it also helps filter out cows that are being attacked. But I do agree that script effectiveness could be lost You could debug the game and find the walking animation and the standing animation, then its just a matter of if(cow.getAnimation() == #### ){ etc } But who can be bothered doing that Edited July 23, 2015 by Tom
Chris Posted July 23, 2015 Author Posted July 23, 2015 That is true, but cows also will be animating while they are under attack. So it also helps filter out cows that are being attacked. But I do agree that script effectiveness could be lost So something like this if(!this.myPlayer().isUnderAttack() && !Cow.isUnderAttack() && this.myPlayer().getInteracting() == null && Cow != null && Cow.isVisible()) { Cow.interact("Attack"); You could debug the game and find the walking animation and the standing animation, then its just a matter of if(cow.getAnimation() == #### ){ etc } But who can be bothered doing that
Tom Posted July 23, 2015 Posted July 23, 2015 So something like this if(!this.myPlayer().isUnderAttack() && !Cow.isUnderAttack() && this.myPlayer().getInteracting() == null && Cow != null && Cow.isVisible()) { Cow.interact("Attack"); if(!this.myPlayer().isUnderAttack() && !Cow.isUnderAttack() && !this.myPlayer().isAnimating()){ Cow.interact("Attack"); } 1
Chris Posted July 23, 2015 Author Posted July 23, 2015 if(!this.myPlayer().isUnderAttack() && !Cow.isUnderAttack() && !this.myPlayer().isAnimating()){ Cow.interact("Attack"); } thanks again!
bob10 Posted July 23, 2015 Posted July 23, 2015 (edited) If you are in need of the npc attack and defending animations, search google for them. Know the name of the community site, but do not wish the break the rule on advertising. Should be the same since it's 2007 servers. Edited July 23, 2015 by bob10
Deceiver Posted July 23, 2015 Posted July 23, 2015 If you are in need of the npc attack and defending animations, search google for them. Know the name of the community site, but do not wish the break the rule on advertising. Should be the same since it's 2007 servers. The client has debug information on this. :p
Chris Posted July 23, 2015 Author Posted July 23, 2015 If you are in need of the npc attack and defending animations, search google for them. Know the name of the community site, but do not wish the break the rule on advertising. Should be the same since it's 2007 servers. just pm me
bob10 Posted July 23, 2015 Posted July 23, 2015 The client has debug information on this. Oh, true. I forgot about using it to check in-game. just pm me Cannot do so.
Isolate Posted June 8, 2017 Posted June 8, 2017 NPC freeCow = getNpcs().closest(npc -> npc != null && npc.getName().equalsIgnoreCase("Cow") && ((npc.getInteracting() == null && !npc.isUnderAttack()) || (npc.getInteracting() != null && npc.getInteracting() == myPlayer())));