Woody Posted September 25, 2015 Author Share Posted September 25, 2015 if(myPlayer().getInteracting() != null) { NPC npc = npcs.closest(npc_name); if (npc != null && npc.isVisible()) { if (hoverEntityOption(npc, "Attack")) { if (myPlayer().getInteracting() != npc) { if (npc.isVisible()) { npc.interact("Attack"); log("Attacking " + npc_name); sleep(random(400, 800)); } else { camera.toEntity(npc); } } } } }else { if(menu.isOpen()) { if(mouse.click(false)) { for(int i = 0; i < 100 && !myPlayer().isUnderAttack(); i++) { sleep(random(20,40)); } } } else { if(npc != null && npc.isVisible()) { if(npc.interact("Attack")) { for(int i = 0; i < 100 && !myPlayer().isUnderAttack(); i++) { sleep(random(20,40)); } } } else if(npc != null && !npc.isVisible()) { camera.toEntity(npc); } else { log(npc_name + " gone?"); } } } I'm having trouble implementing your method. What am I doing wrong? The script keeps logging "npc_name gone?" Don't use the method of how to attack a goblin, that was just an example. There are plenty of other tutorials which can help you more. This snippet is meant for those who knows java. Quote Link to comment Share on other sites More sharing options...
Prolax Posted September 26, 2015 Share Posted September 26, 2015 I'm not using this for attacking goblins. I'm using the variable npc_name, just implementing this into a fighter script. Quote Link to comment Share on other sites More sharing options...
Acinate Posted November 13, 2015 Share Posted November 13, 2015 I like this for(int i = 0; i < 100 && !myPlayer().isUnderAttack(); i++) { sleep(20, 40); } Good job Quote Link to comment Share on other sites More sharing options...