Saving throw check on NPC Perception

Okay, what am I doing wrong? I put this successfully compiled script in the npc’s perception yet none of it fires. If I don’t include distance, it does fire or at least the floating text fires. I have a similar script for an activated item that works beautifully. Yet this on perception is driving me bat-sh-crazy.
here is the script;

void main()
// We are only interested in “seen” events.
if ( !GetLastPerceptionSeen() )

// Get the creature who triggered this event.
object oPC = GetLastPerceived();
object oself=OBJECT_SELF;

// Only fire for (real) PCs.
if ( !GetIsPC(oPC)  ||  GetIsDMPossessed(oPC) )

// Only fire once per PC.
if ( GetLocalInt(oPC, "DO_ONCE__" + GetTag(OBJECT_SELF)) )
SetLocalInt(oPC, "DO_ONCE__" + GetTag(OBJECT_SELF), TRUE);

// Have us perform a sequence of actions.

// If a will saving throw is successful.
 if (GetDistanceBetween(oPC, oself) < 5.0 && !WillSave(oPC, 15))
    // Have text appear over the PC's head.
    FloatingTextStringOnCreature("blah, blah, blah", oPC);
 else  if (GetDistanceBetween(oPC, oself) < 5.0 )
   FloatingTextStringOnCreature("Will save failed!", oPC);


Probably the distance the NPC perceives the PC is > 5.0 so when the event fires neither of your if statements works. It won’t fire again for a seen event until the PC goes out of sight and comes back.

unless the npc spawns into PC face, the distance will be almost always higher than 5.0

Thanks meaglyn and Shadoow. That’s exactly why that script won’t work. I should’ve known that. I think I have another way to make something similar work. Thanks!