GetLastPerceived
From NWN Lexicon
GetLastPerceived()
Returns the last perceived creature in an OnPerception event.
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.
Version
1.22
Example
// OnPerception script that attacks a perceived enemy main() { object oNoticed = GetLastPerceived(); if(GetIsObjectValid(oNoticed)) { if (GetLastPerceptionSeen() && GetIsEnemy(oNoticed)) { ClearAllActions(); ActionAttack(oNoticed); } } }
See Also
author: Tom Cassiotis, editor: Kristian Markon