Skip to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Player in combat

Featured Replies

I cant for the life of me get this to work.

I am trying to attack a cow while my player is not in combat and the cow is not in combat.

I used so many freaking filters but non of them work.

Here is what I currently have:

State definer
  
  
  
NPC cow = getNpcs().closest(cowFilter);
if (cow != null && !myPlayer().isAnimating())
    		return State.ATTACK;


switch case
  
  
  
		case ATTACK:
			NPC cow = getNpcs().closest(cowFilter);
			if (cow != null && !myPlayer().isAnimating())
				cow.interact("Attack");
			break;


cow filter
  
  
  
      Filter<NPC> cowFilter = new Filter<NPC>(){
        public boolean match(NPC npc){
           return (npc.getName().equalsIgnoreCase("Cow") || npc.getName().equalsIgnoreCase("Cow calf")) && !npc.isHitBarVisible() && !npc.isAnimating() && npc.isAttackable() && getMap().canReach(npc);
        }
    };
  

 

Anyone has any idea what I am doing wrong?

Edited by HunterRS

combat.isFighting();
cow.isUnderAttack

combat.isFighting checks if your player is in combat - so change your !myPlayer().isAnimating to !combat.isFighting()
Entity.isUnderAttack will check if entity is under attack - and add this to your cow filter

Edited by GPSwap

  • Author
20 minutes ago, GPSwap said:

combat.isFighting();
cow.isUnderAttack

combat.isFighting checks if your player is in combat - so change your !myPlayer().isAnimating to !combat.isFighting()
Entity.isUnderAttack will check if entity is under attack - and add this to your cow filter

ya just found isFighting, was exactly what I was looking for. 

Ty for your help :)

  • Author
Just now, Alek said:

Why not contains "Cow"? Why do you have to make two separate checks?

 

Just did 2 seperate checks one for the State define and the other for the attack itself.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.