Jump to content

NPC Interact Object clipping


jimmmy23

Recommended Posts

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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