Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.dreambot.api.script.TaskNode;
- import org.dreambot.api.wrappers.interactive.NPC;
- /**
- * Created by 7804364 on 3/4/2016.
- */
- public class KillTask extends TaskNode {
- @Override
- public boolean accept() {
- return getLocalPlayer().getInteractingCharacter() == null;
- }
- @Override
- public int execute() {
- NPC npc = getNpcs().closest("Chicken");
- if (npc != null) { //forgot to nullcheck
- if (npc.exists()) { //exists means its loaded in the region of the map
- if (npc.isOnScreen()) { // view port visible
- if (npc.interact("Attack")) {
- log("Attacking: " + npc);
- }
- } else {
- getCamera().rotateToEntity(npc);
- }
- }
- }
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment