Jump to content

Constant NPE? Need help


Chris

Recommended Posts

Issue


dc0f127a88.png


 


Code Source



package me.sinatra.machine.Activities;
import me.sinatra.machine.util.Activity;
import org.osbot.rs07.api.filter.Filter;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;

/**
* Created by Sinatra on 8/5/2015.
*/
public class attackTarget implements Activity {
@Override
public boolean shouldDoActivity(Script s) {
return ((!s.myPlayer().isAnimating()) && (s.myPlayer().isVisible()) && (!s.myPlayer().isUnderAttack()));
}

@Override
public int doActivity(Script s) throws InterruptedException {
final NPC cow = s.npcs.closest(new Filter<NPC>() {
@Override
public boolean match(NPC npc) {
return npc != null && npc.getName().equals("Cow") && !npc.isUnderAttack() && npc.getHealth() > 0 && s.map.canReach(npc);
}
});
if (!cow.isVisible() || (cow == null)) {
s.camera.toEntity(cow);
s.sleep(s.random(2000));
} else {
cow.interact("Attack");
s.sleep(s.random(300)+3000);
}

return (s.random(500,2000));
}
}

Need help :)


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...