Jump to content

Can NPCS have a Field of view?


Recommended Posts

Im playing Custom NPCS on 1.12.

and I want an NPC with his back to the player not to see and attack the player, even though the player is in his AggroRange. Like in a stealth game where the player can sneak close to an NPC as long as the NPC doesnt see the player. The option "MustSeeTarget" doesn't work because he always sees me, no matter if I am behind the NPC or if the NPC is looking directly at me. I think the option only refers to whether there are blocks between the NPC and the player that block the view.

Is it possible to create a field of view for the NPC with scripting, so that the NPC only attacks the player when he is directly looking in the direction of the player?

As an alternative, I thought that the NPC only has a low agrorange (for example 10 blocks) and if the NPC is then attacked by the player or sees the player within these 10 blocks, then the agrorange is increased to 64, so that the NPC does not directly cancel the agro as soon as you are 10 blocks away again (the NPC uses Range attacks). But is there a better solution? 

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.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.