July 23, 201510 yr 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
July 23, 201510 yr Author There should be an isUnderAttack method for the cow as well thanks for the helpful information!
July 23, 201510 yr !cow.isUnderAttack && !cow.isAnimating The cows tend to roam around a bit, so isAnimating might lose a lot of script effectiveness
July 23, 201510 yr 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, 201510 yr by OG Scripts
July 23, 201510 yr 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, 201510 yr by Tom
July 23, 201510 yr Author 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
July 23, 201510 yr 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"); }
July 23, 201510 yr Author if(!this.myPlayer().isUnderAttack() && !Cow.isUnderAttack() && !this.myPlayer().isAnimating()){ Cow.interact("Attack"); } thanks again!
July 23, 201510 yr 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, 201510 yr by bob10
July 23, 201510 yr 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
July 23, 201510 yr Author 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
July 23, 201510 yr The client has debug information on this. Oh, true. I forgot about using it to check in-game. just pm me Cannot do so.
June 8, 20178 yr NPC freeCow = getNpcs().closest(npc -> npc != null && npc.getName().equalsIgnoreCase("Cow") && ((npc.getInteracting() == null && !npc.isUnderAttack()) || (npc.getInteracting() != null && npc.getInteracting() == myPlayer())));
Create an account or sign in to comment