Xovian wrote...
if(GetIsInCombat(OBJECT_SELF)==FALSE)
That's the stuff. I tried it by playing with the OnCombatRoundEnd, thinking it would only do the checks while the mob is in combat, but it didn't work. So I placed it in the OnPerception script.
In case this may be useful to another, below is my solution to the simple problem of having a creature return to its spawn point once it's done chasing the player.
This requiered two script changes
OnSpawn is where I recorded where the mob spawned at.
void main()
{
SetLocalLocation(OBJECT_SELF, "WHERE_I_SPAWNED", GetLocation(OBJECT_SELF));
}
OnPerception is what sends the mobs back to it's spawn point.
void main()
{
ExecuteScript("nw_c2_default2", OBJECT_SELF);
object oNoticed = GetLastPerceived();
if (GetLastPerceptionSeen() && GetIsEnemy(oNoticed)== FALSE)
{
ClearAllActions();
ActionMoveToLocation( GetLocalLocation( OBJECT_SELF, "WHERE_I_SPAWNED"));
}
}