GetLastPerceptionSeen

From NWN Lexicon
Jump to: navigation, search



GetLastPerceptionSeen()

Determines whether the current perception event was triggered by the last perceived object entering the caller's view.

Description

Use this in an OnPerception script to determine whether the current perception event was triggered by the Seen state changing from FALSE to TRUE.

Returns TRUE if the last perceived object was seen, otherwise FALSE.



Version

1.29

Example

// OnPerception script that attacks a perceived enemy 
void main()
{
     object oNoticed = GetLastPerceived();
     if(GetIsObjectValid(oNoticed))
     {
          if (GetLastPerceptionSeen() && GetIsEnemy(oNoticed))
          {
               ClearAllActions();
               ActionAttack(oNoticed);
          }
     }
}

See Also

functions: 

GetCanSeePC



 author: Tom Cassiotis, editor: Charles Feduke, additional contributor(s): Alex Meduna