Jump to content

NPC Interact Object clipping


Recommended Posts

Posted

Hey, I'm new to scripting.

Something i've noticed is when using the standard

someNpc.interact()

and the NPC is clipped by an object like a wall or tree,

someNpc.isVisible()

is true, even if the NPC cannot be seen. I'm assuming this is because the NPC is on the screen but simply behind an object.

Is there a method that works for object clipping or a way to move the camera so that the npc isn't clipped by anything?

Posted (edited)
5 minutes ago, Night said:

I believe isVisible returns true for 30% or more of the object/npc being visible, but I'm not 100% on that. Are you feeding .interact() a String paramter so it knows what option to click?

Yes I am. I tried completely covering the NPC with a tree/wall, and isVisible was still true. Here's an example snippet:

Entity man = getNpcs().closest("Man");
man.interact("Pickpocket");

 

Edited by jimmmy23
Example
Posted (edited)
24 minutes ago, jimmmy23 said:

Yes I am. I tried completely covering the NPC with a tree/wall, and isVisible was still true. Here's an example snippet:


Entity man = getNpcs().closest("Man");
man.interact("Pickpocket");

 

isVisible doesn't check if an object is behind something else ...
isVisible only checks if the actual entity is on the screen, no matter whats in front or behind it :)

AS far as I know, there is no method to check what you need

Edited by Khaleesi
Posted
4 minutes ago, jimmmy23 said:

But it can still successfully interact with the man even when it's clipped, what exactly does the bool tell me? Is there a better documentation anywhere? it just says

The boolean returns true if successfully interacted yes, if the interaction works why are you concerned about the camera?

Posted (edited)
1 minute ago, jimmmy23 said:

It just seems kind of bot-like to repeatedly right click through a tree to interact with something.

 

Are there any methods that can achieve what I want?

 

Thanks to both of you for the help btw.

Not that I'm aware, I also don't think that's somehting jagex actual can check ... :)

Edited by Khaleesi

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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