How do I calculate when a character is within an angle?

The linked thread seems to have everything you need, but here’s a more visual example - perhaps that helps:

Essentially, you want to use dot product and, optionally, convert it to angle. There are more examples linked under the above post.