So, you have 2 conditions:
IF player is within a constant RADIUS
AND
IF player is within a direct line of sight.
The radius test is simple. To do direct line of sight, first you need to identify obstructions (walls, cabinets, tall plants, etc...) somehow.
You could use passability, but then short objects like tables, chests would block line of sight.
I would suggest using a terrain type. (does this still exist in Ace?)
Then you need an algorithm to check every tile between the NPC & player.
I would do it this way:
Check the Delta distance between the NPC & Player
Using whichever distance is larger (X or Y), iterate through a formula to solve the other axis.
So, if NPC is at (0,0), and player is at (2,3), The Y distance is larger.
The formula is X = Y * 0.75
So,
when Y = 0, X = 0
when Y = 1, X = 0.75
when Y = 2, X = 1.5
when Y = 3, X = 2
When X (in this case) is a fractional number. (X%1 > 0), You need to both round up, and round down.
So, when X = 0.75, you need to check for both X = 0 & X = 1
So, the tiles you have to check are: (0,0) (0,1) (1,1) (1,2) (2,2) (2,3) You can skip the first & last, since a character is standing on that tile.
If any one of those tiles is an obstruction, no detection occurs.
Make sense?