function AISMN_MoveBackAndForth::OnEnter(%this,%obj)
{
   %x0 = PathingPosX(%obj);
   %y0 = PathingPosY(%obj);
   
   %x1 = LastPathDestX(%obj);
   %y1 = LastPathDestY(%obj);
   
   if(0 == %x1 && 0 == %y1)
      SetPathToSpot(%obj,%x0+50,%y0+50);
   if( (%x0 != %x1 && %y0 != %y1) )
	   SetPathForLastLocation(%obj);
   else
      SetPathToSpot(%obj,%x0+12,%y0+12);
      
   GetThisObject(%obj).playThread( 0, "run");
	
	return;
}

function AISMN_MoveBackAndForth::OnExit(%this,%obj)
{   
   GetThisObject(%obj).playThread( 0, "root");
	return;
}

function AISMN_MoveBackAndForth::Update(%this,%obj)
{
	if(!IsFollowingPath(%obj))
		SetPathForLastLocation(%obj);
	ReturnValue(%obj,-1);
	return;
}