I have a script triggered by Nearest, and I tried substituting LastSeenBy() in the same trigger block with Nearest, plus a custom spell state. I also have a SecondNearest trigger and response block, identical, down in the script. This is for an invisible creature, temporarily visible actually, who is supposed to cast a spell on the nearests who satisfy this condition. I'm testing it in the courtyard of the Friendly Arm Inn, where there are some standing, ass-scratching peasants, a few guards and a couple of NPC I conjured up for the test.
Well, the script is simple, just what it says above. And I can't say it never works. Sometimes the creature sees - that is, detects - the enchanted one and casts the spell on him. But sometimes it doesn't, even if he's rubbing against it. One time I put an Ajantis in that spell state, the creature ignored him, but the second one, summoned with the same effect, did see him. And so on, and so forth. I've never had it happen to me in the game that an enemy would fail to see someone next to him, but these one-eyed menials regularly just stand there gawking.
Any ideas about what may be going on? I have an extra spell up in the beginning of the list that the creature casts on itself before other actions. My attempt at glasses - it sets Self Visual range to 15 (the maxiumum, according to the G3 guide).