Hi I got some problem with my script and i don't know whats wrong I got it to work for aggro the rockcrabs (wake them up) then when im trying to add an attack method its not working please help me. And im really nooby on java as i sad my first real project.
package killer;
import java.awt.Graphics;
import org.osbot.script.Script;
import org.osbot.script.ScriptManifest;
import org.osbot.script.rs2.model.Entity;
import org.osbot.script.rs2.model.Player;
@ScriptManifest(author = "GiimpeN", info = "Kills RockCrabs", name = "CrabKiller", version = 0.1)
public class CrabKiller extends Script {
public void onStart() {
log("Script Started.");
}
public void onExit() {
}
public int onLoop() throws InterruptedException {
Player player = client.getMyPlayer();
Entity Rocks = closestNPC(73, 71);
if (Rocks != null) {
if (!Rocks.isVisible()) {
client.moveCameraToEntity(Rocks);
if (!player.isMoving()) {
if (!player.isAnimating()) {
Rocks.interact("Walk here");
sleep(random(700, 800));
}
}
}
}
return 50;
}
public int onLoop1() throws InterruptedException {
Entity rockcrab = closestAttackableNPCForName("Rock Crab");
Player player = client.getMyPlayer();
if (player.isUnderAttack()) {
rockcrab.interact("Attack");
if (!rockcrab.isVisible()) {
client.moveCameraToEntity(rockcrab);
}
}
return 50;
}
public void onPaint(Graphics g) {
}
}