{
	saved_Patrolling [1]
	saved_StalkMode [1]

	saved_anim_crouchRun [0]
	saved_anim_crouchWalk [1]
	saved_anim_aimCrouch [10]
	saved_anim_aimStand [13]
	saved_anim_idleCrouch [8]
	saved_anim_idleStand [7]
	
	saved_firsttime [1]

	GoCrouched[ (s)
	{
		SetCrouching();
		PlayAnimation(s);
	} ]
	GoRunning[ (s)
	{
		SetRunning();
		PlayAnimation(s);
	} ]
	GoWalking[ (s)
	{
		SetWalking();
		PlayAnimation(s);
	} ]

	Init[ (s)
	{
		if(saved_firsttime = 1)
		{
			saved_firsttime = 0;
			
			SetNationality(1);
			GiveWeapon(56);
			PlayAnimation(7);
	
			if (GetID() = "enemy5"){ PlayAnimation(8); }
	
			if ((GetID() = "enemy15") or (GetID() = "enemy19") or (GetID() = "enemy20") or (GetID() = "enemy22") or (GetID() = "enemy24"))
			{
				GoCrouched(saved_anim_aimCrouch);
			}
			if (GetID() = "enemy25")
			{
				GoCrouched(saved_anim_idleCrouch);
			}
			if (GetID() = "enemy26")
			{
				Moody = Level.GetEntity("moody");
				TurnTo( Moody );
				GoCrouched(saved_anim_aimCrouch);
			}
			if (GetID() = "enemy29")
			{
				Moody = Level.GetEntity("moody");
				PlayAnimation(saved_anim_aimCrouch);
				TurnTo( Moody );
			}
			if ((GetID() = "enemy31") or (GetID() = "enemy32") or (GetID() = "enemy34") or (GetID() = "bubba2") or (GetID() = "bubba3"))
			{
				PlayAnimation(saved_anim_aimCrouch);
			}
			if (GetID() = "bubba5")
			{
				saved_Patrolling = 1;
				PlayAnimation(saved_anim_idleStand);
				WalkTo(24576,41804,200,1);
			}
			if (GetID() = "bubba6")
			{
				saved_Patrolling = 1;
				PlayAnimation(saved_anim_idleStand);
				WalkTo(24473,39884,210,1);
			}
			if ((GetID() = "bubba7") or (GetID() = "bubba8"))
			{
				PlayAnimation(saved_anim_aimCrouch);
			}
			if ((GetID() = "bubba9") or (GetID() = "bubba12"))
			{
				PlayAnimation(saved_anim_aimCrouch);
				TurnTo( Level.GetPlayer() );
			}
			if(GetID() = "bubba10")
			{
				PlayAnimation(saved_anim_idleCrouch);
				TurnTo( Level.GetPlayer() );
			}
			if ((GetID() = "bubba13") or (GetID() = "bubba14"))
			{
				SetCrouching();
				PlayAnimation(saved_anim_aimCrouch);
			}
			if(GetID() = "bubba16")
			{
				SetWalking();
				PlayAnimation(saved_anim_idleCrouch);
			}
			if(GetID() = "bubba17")
			{
				SetRunning();
				PlayAnimation(saved_anim_aimStand);
			}
			if(GetID() = "bubba18")
			{
				SetCrouching();
				PlayAnimation(saved_anim_idleCrouch);
			}
			if ((GetID() = "bubba19") or (GetID() = "npc1"))
			{
				SetCrouching();
				PlayAnimation(saved_anim_aimCrouch);
			}
			if  ((GetID() = "npc3") or (GetID() = "npc5") or (GetID() = "npc6") or (GetID() = "npc8"))
			{
				Moody = Level.GetEntity("moody");
				SetCrouching();
				PlayAnimation(saved_anim_aimCrouch);
				TurnTo( Moody );
			}
			if(GetID() = "npc10")
			{
				SetWalking();
				PlayAnimation(saved_anim_crouchRun);
				WalkTo(21376,27790,410,2);
			}
			if(GetID() = "npc11")
			{
				SetWalking();
				PlayAnimation(saved_anim_crouchRun);
				WalkTo(22869,27889,400,2);
			}
			if(GetID() = "npc12")
			{
				SetCrouching();
				PlayAnimation(saved_anim_aimCrouch);
			}
			if(GetID() = "npc13")
			{
				PlayAnimation(saved_anim_aimStand);
				TurnTo( Level.GetPlayer() );
			}
			if(GetID() = "npc14")
			{
				PlayAnimation(saved_anim_aimCrouch);
				TurnTo(Level.GetPlayer() );
			}
			if(GetID() = "npc15")
			{
				SetCrouching();
				PlayAnimation(saved_anim_idleCrouch);
			}
			if(GetID() = "npc16")
			{
				SetCrouching();
				PlayAnimation(saved_anim_idleCrouch);
			}
			if(GetID() = "npc17")
			{
				SetCrouching();
				PlayAnimation(saved_anim_aimCrouch);
				TurnTo(Level.GetPlayer());
			}
			if(GetID() = "npc18")
			{
				SetWalking();
				PlayAnimation(saved_anim_crouchWalk);
				WalkTo(20508,16497,450,2);
			}
			if(GetID() = "npc19")
			{
				SetWalking();
				PlayAnimation(saved_anim_crouchWalk);
				WalkTo(21916,15758,460,2);
			}
			if(GetID() = "npc20")
			{
				SetCrouching();
				PlayAnimation(saved_anim_aimCrouch);
				TurnTo( Level.GetPlayer());
			}
			if(GetID() = "npc21")
			{
				SetCrouching();
				PlayAnimation(saved_anim_idleCrouch);
			}
			
			
		}
	} ]

	Wake[ (s)
	{
		saved_Patrolling = 0;
		SetRunning();
		PlayAnimation(13);
		Attack( GetPlayer() );
		TurnTo( GetPlayer() );
	} ]


	StalkCrouched[ (s)
	{
		saved_Patrolling = 0;
		saved_StalkMode = 1;
		SetCrouching();
		PlayAnimation(1);
		Attack( GetPlayer(),true,4);
	}]
	StalkStanding[ (s)
	{
		saved_Patrolling = 0;
		saved_StalkMode = 2;
		SetRunning();
		PlayAnimation(0);
		Attack( GetPlayer(),true,5);
	}]


	ReachedFollow[ (id)
	{
		TurnTo( GetPlayer() );
		if (saved_StalkMode = 1 )
		{
			PlayAnimation(10);
		}
		else
		{
			PlayAnimation(13);
		}
	}]

	ReachedDestination[ (s)
	{
		if( saved_Patrolling = 1 )
		{
			if( not IsDead() )
			{
				if (s=2)
				{
					PlayAnimation(saved_anim_aimCrouch);
					TurnTo( Level.GetPlayer());
					Attack( Level.GetPlayer());
				}
				if (s=5)
				{
					PlayAnimation(13);
					Delay(3,5);
				}
				if (s=10)
				{
					TurnTo(20138,3690);
					PlayAnimation(7);
					Delay(5,10);
				}
				if (s=20)
				{
					PlayAnimation(7);
					Delay(1,20);
				}
				if (s=21)
				{
					TurnTo(18602,3264);
					PlayAnimation(13);
					Delay(2,23);
				}
				if (s=22)
				{
					TurnTo(15746,6058);
					PlayAnimation(13);
					Delay(1,25);
				}
				if (s=30)
				{
					TurnTo(21098,7829);
					PlayAnimation(7);
					Delay(2,30);
				}
				if (s=31)
				{
					TurnTo(23232,5205);
					PlayAnimation(7);
					Delay(3,31);
				}
				if (s=32)
				{
					TurnTo(21623,6236);
					PlayAnimation(13);
					Delay(1,32);
				}
				if (s=40)
				{
					TurnTo(16448,11392);
					PlayAnimation(7);
					Delay(6,40);
				}
				if (s=41)
				{
					TurnTo(13226,8640);
					PlayAnimation(7);
					Delay(4,41);
				}
				if(s=50)
				{
					StalkCrouched();
				}
				if(s=60)
				{
					Moody = Level.GetEntity("moody");
					PlayAnimation(saved_anim_aimCrouch);
					TurnTo( Moody );
				}
				//if(s=70)
				//{
				//	Moody = Level.GetEntity("moody");
				//	PlayAnimation(13);
				//	TurnTo( Moody );
				//	Attack( Moody );
				//}
				if(s=71)
				{
					Moody = Level.GetEntity("moody");
					PlayAnimation(13);
					TurnTo( Moody );
					Attack( Moody );
				}
				//if(s=74)
				//{
				//	Moody = Level.GetEntity("moody");
				//	PlayAnimation(saved_anim_aimCrouch);
				//	TurnTo( Moody );
				//	Attack( Moody );
				//}
				if(s=100)
				{
					PlayAnimation(saved_anim_aimCrouch);
					TurnTo( Level.GetPlayer() );
					Attack( Level.GetPlayer() );
				}
				if(s=200)
				{
					TurnToLocation(25267,43161);
					PlayAnimation(saved_anim_idleStand);
					Delay(2,50);
				}
				if(s=201)
				{
					TurnToEntity( Level.GetPlayer() );
					PlayAnimation( saved_anim_idleStand );
					Delay(1,52);
				}
				if(s=210)
				{
					TurnToLocation(Random(23168,25228),38361);
					PlayAnimation(saved_anim_idleStand);
					Delay(Random(3,6),60);
				}
				if(s=211)
				{
					TurnToLocation(22144,Random(40857,36812));
					PlayAnimation(saved_anim_idleStand);
					Delay(Random(2,6),61);
				}
				if(s=250)
				{
					PlayAnimation(saved_anim_aimCrouch);
					TurnTo( Level.GetPlayer() );
					Attack( Level.GetPlayer() );
				}
				if(s=300)
				{
					PlayAnimation(saved_anim_aimCrouch);
					TurnTo( Level.GetPlayer() );
					Attack( Level.GetPlayer() );
				}
				if(s=301)
				{
					PlayAnimation(saved_anim_aimStand);
					TurnTo( Level.GetPlayer() );
					Attack( Level.GetPlayer() );
				}
				if(s=400)
				{
					PlayAnimation(saved_anim_idleStand);
					TurnToEntity( Level.GetPlayer() );
					Delay( Random(2,6),80);
				}
				if(s=401)
				{
					PlayAnimation(saved_anim_idleStand);
					TurnToEntity( Level.GetPlayer() );
					Delay( Random(2,6),81);
				}
				if(s=410)
				{
					PlayAnimation(saved_anim_aimStand);
					TurnToLocation( Random(20000,26000), 26000 );
					Delay( Random(2,6), 85);
				}
				if(s=411)
				{
					PlayAnimation(saved_anim_aimStand);
					TurnToLocation( Random(20000,26000), 26000 );
					Delay( Random(2,6), 86);
				}
				if(s=420)
				{
					PlayAnimation(saved_anim_aimCrouch);
					TurnTo( Level.GetPlayer() );
					Attack( Level.GetPlayer() );
				}
				if(s=450)
				{
					PlayAnimation(saved_anim_aimStand);
					TurnToLocation( 18304, Random(15000,19000));
					Delay( Random(2,6),100);
				}
				if(s=451)
				{
					PlayAnimation(saved_anim_idleStand);
					TurnToEntity( Level.GetPlayer() );
					Delay(Random(2,6),101);
				}
				if(s=460)
				{
					PlayAnimation(saved_anim_idleStand);
					TurnToLocation(Random(18300,23600),14000);
					Delay(Random(2,6),110);
				}
				if(s=461)
				{
					PlayAnimation(saved_anim_idleStand);
					TurnToLocation(18500,Random(16500,10000));
					Delay(Random(2,6),111);
				}
				if(s=500)
				{
					Wake();
				}
			}
		}
		else
		{
			SetRunning();
			PlayAnimation(13);
			return;
		}
	}]

	DelayReached[ (s)
	{
		if( not IsDead() )
		{
			if(s=5)
			{
				TurnTo(23082,3114);
				PlayAnimation(7);
				Delay(1,6);
			}
			if(s=6)
			{
				TurnTo(21376,2922);
				Delay(5,7);
			}
			if(s=7)
			{
				TurnTo(21435,2927);
				PlayAnimation(0);
				WalkTo(20437,4672,10,2);
			}
			if(s=9)
			{
				PlayAnimation(7);
				Delay(2,11);
			}
			if(s=10)
			{
				PlayAnimation(13);
				TurnTo(21504,3114);
				Delay(2,12);
			}
			if(s=12)
			{
				PlayAnimation(0);
				WalkTo(21760,4629,5,2);
			}

			if(s=20)
			{
				TurnTo(18304,6805);
				PlayAnimation(7);
				Delay(3,22);
			}
			if(s=21)
			{
				WalkTo(19818,6528,20,1);
			}
			if(s=22)
			{
				PlayAnimation(0);
				WalkTo(19306,5482,22,2);
			}
			if(s=23)
			{
				PlayAnimation(7);
				TurnTo(21120,1408);
				Delay(4,24);
			}
			if(s=24)
			{
				PlayAnimation(0);
				WalkTo(19818,6528,20,2);
			}
			if(s=25)
			{
				PlayAnimation(13);
				Delay(1,26);
			}
			if(s=26)
			{
				PlayAnimation(0);
				WalkTo(19818,4736,21,2);
			}
			if(s=30)
			{
				PlayAnimation(0);
				WalkTo(21696,5888,31,1);
			}
			if(s=31)
			{
				PlayAnimation(0);
				WalkTo(21632,6314,32,1);
			}
			if(s=32)
			{
				PlayAnimation(0);
				WalkTo(20842,6528,30,1);
			}
			if(s=40)
			{
				//Level.Debug("Delay40");
				PlayAnimation(0);
				WalkTo(13930,9856,41,1);
			}
			if(s=41)
			{
				//Level.Debug("Delay41");
				TurnTo(15274,9130);
				PlayAnimation(13);
				Delay(2,42);
			}
			if(s=42)
			{
				//Level.Debug("Delay42");
				PlayAnimation(0);
				WalkTo(14080,11648,40,1);
			}
			if(s=50)
			{
				TurnToLocation(24128,44044);
				PlayAnimation(saved_anim_aimStand);
				Delay(4,51);
			}
			if(s=51)
			{
				SetCrouching();
				PlayAnimation(saved_anim_crouchRun);
				WalkTo(23936,41600,201,1);
			}
			if(s=52)
			{
				TurnToLocation(22246,43315);
				PlayAnimation(saved_anim_idleStand);
				Delay(6,53);
			}
			if(s=53)
			{
				SetCrouching();
				PlayAnimation(saved_anim_crouchRun);
				WalkTo(24576,41804,200,1);
			}
			if(s=60)
			{
				PlayAnimation(saved_anim_crouchRun);
				WalkTo(23700,Random(40000,40500),211,2);
			}
			if(s=61)
			{
				PlayAnimation(saved_anim_crouchRun);
				WalkTo(24473,39884,210,1);
			}
			if(s=70)
			{
				Bubba9 = Level.GetEntity("bubba9");
				if( not Bubba9.IsDead() )
				{
					Bubba9.Attack( Level.GetPlayer() );
				}
			}
			if(s=80)
			{
				PlayAnimation(saved_anim_crouchRun);
				WalkTo(22912,29297,401,2);
			}
			if(s=81)
			{
				PlayAnimation(saved_anim_crouchRun);
				WalkTo(22869,27889,400,2);
			}
			if(s=85)
			{
				PlayAnimation(saved_anim_crouchRun);
				WalkTo(22485,27776,411,2);
			}
			if(s=86)
			{
				PlayAnimation(saved_anim_crouchRun);
				WalkTo(21376,27790,410,2);
			}
			if(s=90)
			{
				PlayAnimation(1);
				WalkTo(16782,18560,420,2);
			}
			if(s=100)
			{
				PlayAnimation(1);
				WalkTo( Random(20480,20992), 17464,451,2);
			}
			if(s=101)
			{
				PlayAnimation(1);
				WalkTo(20508,16497,450,2);
			}
			if(s=110)
			{
				PlayAnimation(1);
				WalkTo(20593,15758,461,2);
			}
			if(s=111)
			{
				PlayAnimation(1);
				WalkTo(21916,15758,460,2);
			}
		}
	}]
}
