GetLastPerceived()
Determines the last perceived creature in an OnPerception event.
object GetLastPerceived();
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
| categories: | Perception Functions |
author: Tom Cassiotis, editor: Kristian Markon