function AISMN_VisitJail::OnEnter(%this, %cmpAI)
{
   if(SetPathForNearestTeamBuilding(%cmpAI, "SheriffsOffice", $OST_PLAYER)) 
   {
      %object = GetThisObject(%cmpAI);
      %cmpChar = slgQueryInterface(%object, $CID_CHARACTER);
      if(isObject(%cmpChar)) {
         %cmpChar.setState($CharacterState::Reform);
      }
      if(%cmpAI.isDrunk())
         %object.playThread(0, "drunkwalk");
      else
         %object.playThread(0, "run");
   }
	
	return;
}

function AISMN_VisitJail::OnExit(%this, %cmpAI)
{
   GetThisObject(%cmpAI).playThread(0, "root");
}

//EXIT 0: ARRIVED AT LOCATION (FOR NON-DRUNKS)
//EXIT 1: ARRIVED AT LOCATION (FOR DRUNKS)
function AISMN_VisitJail::Update(%this, %cmpAI)
{
   if(!IsFollowingPath(%cmpAI))
   {
      if(!%cmpAI.isDrunk())
         ReturnValue(%cmpAI, 0);
      else
         ReturnValue(%cmpAI, 1);
      return;
   }
   ReturnValue(%cmpAI, -1);
   return;
}