September 25, 201510 yr Author 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.
September 26, 201510 yr I'm not using this for attacking goblins. I'm using the variable npc_name, just implementing this into a fighter script.
November 13, 201510 yr I like this for(int i = 0; i < 100 && !myPlayer().isUnderAttack(); i++) { sleep(20, 40); } Good job
Create an account or sign in to comment