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.

underAttack() broken

Featured Replies

Quickfix for developers (not 100% at all):

 

Check if the NPC's health is 100 and their getFacing() returns null or your player.

 

I'm using that atm with my fighter and it's working pretty well :)

You shouldn't really use the #underAttack method for combat scripts. It's better to check if your character isn't interacting with anything. underAttack should only be used for other scripts such as checking if anything is attacking you while you're skilling or something. the #underAttack method uses your characters combat timer the client uses to check weither you can log out or not. 

  • Author

You shouldn't really use the #underAttack method for combat scripts. It's better to check if your character isn't interacting with anything. underAttack should only be used for other scripts such as checking if anything is attacking you while you're skilling or something. the #underAttack method uses your characters combat timer the client uses to check weither you can log out or not. 

I do check whether or not i'm "interacting" with an NPC, but you've got to use underAttack() to know whether the NPC you intend on killing is already under attack.

 

 

Thank you. Now the users of my combat scripts will stop thinking I'm making it up tongue.png

LMFAO, I know the feel :P

 

Edited by Deffiliate

 

I do check whether or not i'm "interacting" with an NPC, but you've got to use underAttack() to know whether the NPC you intend on killing is already under attack.

 

 
LMFAO, I know the feel tongue.png

 

 

You can use facing for that

for what?

 

You can check the facing of the monster you are attempting to attack, to determine whether it is in combat or not.

  • Author

You can check the facing of the monster you are attempting to attack, to determine whether it is in combat or not.

I don't believe this is true in all cases. I would have to check getFacing() ==null || getFacing()==myPlayer(), but sometimes the NPC will be facing one player while being attacked by another.

 

 

Anywho, please fix guys. KThxBai

I don't believe this is true in all cases. I would have to check getFacing() ==null || getFacing()==myPlayer(), but sometimes the NPC will be facing one player while being attacked by another.

 

 

Anywho, please fix guys. KThxBai

 

It is true in all cases, because it is not important to us whether I am being faced by it, or is someone else faced by it. What matters, is that the facing != null, that means that this monster is in-combat. 

  • Author

It is true in all cases, because it is not important to us whether I am being faced by it, or is someone else faced by it. What matters, is that the facing != null, that means that this monster is in-combat. 

Still not necessarily true though. Just because an NPC is attacking something doesn't mean it's being attacked.

 

Edit: matter of fact, this wouldn't work at all in my case. My script safe-spots dragons, so when it attacks the dragon then returns to the safespot the dragon will be facing my player, therefore it wouldn't attack the dragon again.

Edited by Deffiliate

Still not necessarily true though. Just because an NPC is attacking something doesn't mean it's being attacked.

 

Edit: matter of fact, this wouldn't work at all in my case. My script safe-spots dragons, so when it attacks the dragon then returns to the safespot the dragon will be facing my player, therefore it wouldn't attack the dragon again.

If you oh so want to know if it's under attack you could just check for every interacting entity for every player and see if one of these is the monster you're trying to find information on.

Still not necessarily true though. Just because an NPC is attacking something doesn't mean it's being attacked.

 

Edit: matter of fact, this wouldn't work at all in my case. My script safe-spots dragons, so when it attacks the dragon then returns to the safespot the dragon will be facing my player, therefore it wouldn't attack the dragon again.

 

It is true for single target areas.

Also, It would work, you just would need to write your attacking function in a different matter. Works for my metal dragon killer.

 

 

Edited by Nitrousek

  • Author

If you oh so want to know if it's under attack you could just check for every interacting entity for every player and see if one of these is the monster you're trying to find information on.

I would love to do that. However I don't think this API has a method for getInteracting(), only getFacing() which isn't the same. (Correct me if i'm wrong please)

 

It is true for single target areas.

No it's not. Check for yourself, if a NPC attacks you and then another player attacks it before you attack back, the NPC will face you for awhile before facing the other player.

Also, It would work, you just would need to write your attacking function in a different matter. Works for my metal dragon killer.

I'm not going to re-write my code to accommodate a method that doesn't return what I'm looking for.

I would love to do that. However I don't think this API has a method for getInteracting(), only getFacing() which isn't the same. (Correct me if i'm wrong please)

 

No it's not. Check for yourself, if a NPC attacks you and then another player attacks it before you attack back, the NPC will face you for awhile before facing the other player.
 

I'm not going to re-write my code to accommodate a method that doesn't return what I'm looking for.

 

Then check whether any player is facing the monster that is facing you, and problem resolved. If any player is facing the monster that is facing you, that means, the monster is being attacked by another player, as there is no way for a player to be facing a monster and not attacking it. GetFacing essentially returns what you mean by getInteracting I believe. (Depends on what you believe getInteracting should return)

Edited by Nitrousek

Guest
This topic is now closed to further replies.

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.