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

Attacking

Featured Replies

Hey guys, so I currently have a problem where, my script will still attack an NPC that is under attack from someone using Magic that does no damage.

 

Currently someone is using magic, and they're doing no damage to the cow, so the cow's hp bar isn't showing up, but the cow is attacking back, but my script thinks it's not fighting and tries to attack it?

 

Here's my filter:

                NPC cow = getNpcs().closest(new Filter<NPC>() {
                    @@Override
                    public boolean match(NPC cow) {
                        return cow.getName().startsWith("Cow")
                                && cow.isAttackable() && !cow.isUnderAttack()
                                && cow.getHealthPercent() > 0
                                && cowArea.contains(cow);
                    }
                });

 

Thanks!

Edited by Annointed

check if its not interacting with anything?

Hey guys, so I currently have a problem where, my script will still attack an NPC that is under attack from someone using Magic that does no damage.

 

Currently someone is using magic, and they're doing no damage to the cow, so the cow's hp bar isn't showing up, but the cow is attacking back, but my script thinks it's not fighting and tries to attack it?

 

Here's my filter:

 

 

 

Thanks!

 

Just FYI the:

!cow.isUnderAttack() && cow.getHealthPercent() > 0

Is redundant because:

cow.isAttackable()

Does:

npc.getHealthPercent() > 0 && !npc.isUnderAttack() || npc.isInteracting(getMethods().myPlayer())

As for your issue you could try doing:

NPC cow = getNpcs().closest(npc -> npc.getName().startsWith("Cow") && cowArea.contains(npc) && npc.isAttackable() && npc.getInteracting() == null);

 

Just FYI the:

!cow.isUnderAttack() && cow.getHealthPercent() > 0

Is redundant because:

cow.isAttackable()

Does:

npc.getHealthPercent() > 0 && !npc.isUnderAttack() || npc.isInteracting(getMethods().myPlayer())

As for your issue you could try doing:

NPC cow = getNpcs().closest(npc -> npc.getName().startsWith("Cow") && cowArea.contains(npc) && npc.isAttackable() && npc.getInteracting() == null);

+1. Perfect explanation as always. .getInteracting is very useful.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

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.