GetLastPerceived

From NWN Lexicon



Contents

[edit] GetLastPerceived()

Returns the last perceived creature in an OnPerception event.

[edit] Description

Use this in an OnPerception script to get the object that was perceived.

Returns the object that was perceived and OBJECT_INVALID if the caller is not a valid creature.



[edit] Version

1.22

[edit] Example

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

[edit] See Also



 author: Tom Cassiotis, editor: Kristian Markon
 

Personal tools
Categories