Jump to content

Need help with attack


boyyo11

Recommended Posts

So before I got to serious into the script I was at vwest and tried to make a simple fighter that would kill guards, after that id make my script for me to get max cb, but I cant seem to make it work out. The one I made will attempt to try and click one after a min of following it with the mouse, than it will interact with it, than it will fight it, than wont do anything, it seems to not loop at all even tho I know it clearly does. Here is my script as it is, id like to add camera movement as well if that isnt in the interact with method already, Im not sure but seems to be but this script has so many bugs idk what is right or wrong. Thanks a bunch!

package com.embah.AIOFighter;

import java.awt.Graphics2D;

import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.Area;

@ScriptManifest(author = "Boyyo11", info = "AIO Fighter for 99 combat in the stat of your choice!", name = "AIO FIGHTER", version = 0, logo = "oo embah forever oo")
public class AIOFighter extends Script{
	private Area fightingLocation = new Area(3169, 3423, 3184, 3432);
	private Area bankLocation;
	private boolean isBanking;
	private Walker walker;
	private int[] startPoint = new int[2];
	private int[] endPoint = {3185, 3436};
	
	private NPC guard;
	
	private String status = "Loading";
	
	@Override
	public void onStart() throws InterruptedException {
		
	}

	@Override
	public int onLoop() throws InterruptedException {
		status = "In Loop: ";
		guard = npcs.closest(3011);
		if(guard != null){
			status = "In Loop: guard != null";
			if(!guard.isVisible()){
				status = "In Loop: guard is not visible";
//				while(camera.toEntity(guard) != true){
//					status = "In Loop: moving camera to guard than waiting";
//					sleep(random(300, 400));
//				}
			} else if(!guard.isUnderAttack() && fightingLocation.contains(guard) && myPlayer().isAttackable()){
				status = "In Loop: Attacking if guard is in location and both opponents arent under attack";
				guard.interact("Attack");
				sleep(random(100, 200));
			} else {
				status = "In Loop: Sleeping because nothing else worked, prolly no guards";
				sleep(random(500, 600));
			}
		}
		return random(50, 100);
	}

	@Override
	public void onExit() {
		log("Cya later!");
	}

	@Override
	public void onPaint(Graphics2D g) {
		g.drawString(status, 5, 10);
	}
}

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...