Jump to content

Warrior killer


theholyman

Recommended Posts

This is my first ever script this is a work in progress i am using this script to learn more and how to do different things so any help is appreciated.


The purpose of this script is to kill al-kharid warriors .

 

The code. ( I'm still learning so no need to be harsh but any help is appreciated )

package warriorkiller;

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;
import org.osbot.script.rs2.utility.Area;

@ScriptManifest(author = "Brody", info = "Kills warriors at al-kharid", name = "Basic warrior", version = 0.2)
public class basicwarrior extends Script {
	
	final String WARRIOR = "Al-Kharid warrior";
	final Area PALACE = new Area (3305, 3175, 3280, 3179);
	
	@Override
	public void onStart() {
		//Before the script starts it goes through this method
		log("Go to the palace at al-kharid for this script to work");
	}
	
	
	@Override
	public void onPaint(Graphics g) {
		//Graphics (displaying graphics on screen)
	}
	
	@Override
	public int onLoop() throws InterruptedException	{
		Player player = client.getMyPlayer();
		Entity kharid = closestAttackableNPCForName("WARRIOR");
		
		if (PALACE.contains(player)); {
		if (kharid !=null) {
			if (kharid.isVisible()) {
			if (!client.getMyPlayer().isUnderAttack()) {
			kharid.interact("Attack");
			sleep(random(600, 700));
			} else {
				client.moveCameraToEntity(kharid);
			}
		}
		}
		}
		return 50; //sleep time
	}
	
	@Override
	public void onExit() {
		//when stopped
		log("thanks for using my script I hope you enjoyed it and it benefited you!.");
	}
	
}

What needs to be done

 

Banking

Picking up items

Eating

Will add more in future

Edited by theholyman
Link to comment
Share on other sites

Good start, but one thing I've noticed already:

		Entity kharid = closestAttackableNPCForName("WARRIOR");

In this line, you're literally searching for an NPC called "WARRIOR". You need to remove the quotation marks from around WARRIOR so that line of code will reference your WARRIOR variable and search for the string "Al-Kharid warrior" .

Edited by Deffiliate
Link to comment
Share on other sites

 

Good start, but one thing I've noticed already:

		Entity kharid = closestAttackableNPCForName("WARRIOR");

In this line, you're literally searching for an NPC called "WARRIOR". You need to remove the quotation marks from around WARRIOR so that line of code will reference your WARRIOR variable and search for the string "Al-Kharid warrior" .

 

 

Thanks i didn't realise that ill fix right away

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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