{
	saved_FirstTime[0]

	Init[ ()
	{
		if(saved_FirstTime=0)
		{
			saved_FirstTime=1;

			SetNationality(2);
			SetRunning();
			PlayAnimation(7);
			GiveWeapon(44, 6);
			SetInvulnerable(1);
		}
	}]

	DelayReached[ (s)
	{
		if(s = 1)
		{
			flakgun = Level.GetEntity("flak");
			flakgun.SetUsable(true);
			flakgun.SetUseText(169);
			TurnToLocation(13440, 10624);
			PlayAnimation(28, 1, 7);
			Level.GetPlayer().PlaySound(77,100, true);
			Delay(4, 2);  Level.Log("%%% Calling Price DELAY 2 %%%");
		}
		if(s = 2)
		{
			TurnToLocation(16256, 12121);
			Delay(1, 3);  Level.Log("%%% Calling Price DELAY 3 %%%");
		}
		if(s = 3)
		{
			Delay(1, 4);  Level.Log("%%% Calling Price DELAY 4 %%%");
		}
		if(s = 4)
		{
			GoForCover();
			Self = GetPlayer();
			Self.SetFrozen(false);
		}
		if(s = 5)
		{
			Level.saved_StopBomb = 1;
			ResumeFollowingPath();
		}
		if(s = 6)
		{

			ResumeFollowingPath();
			FollowPathCallback(6, "RunGun");
		}
		if(s = 7)
	        {
			if( Level.saved_StopBomb = 0 )
			{
			    xPos = Random(17760,21888);
			    yPos = Random(12432, 16000);
			    zPos = 136;

			    xPos2 = Random(10336,16576);
			    yPos2 = Random(12368, 16560);
			    zPos2 = 136;

			    BombsAway(xPos,yPos,zPos);
			    BombsAway2(xPos2,yPos2,zPos2);
			}
	        }
	        if(s = 8)
	        {
			Level.saved_GoDestroyTank = 1;	// turns on tank spawn
		}
		if( s = 9)
		{
			Level.Victory();
			Delay(8,10);
		}
		if(s=10)
		{
			Level.LoadLevel("S_BRM2_TheDam");
		}

	}]

	BarkRetreat[ ()
	{
		Level.GetPlayer().PlaySound(73, 100, 0);
		SetState_Idle();
		FollowPath("Price_Retreat");
		FollowPathCallback(127,"GoOnAlert");
	}]

	BarkTank[ ()
	{
		Level.GetPlayer().PlaySound(76, 100, true);
	}]

	WaitForClear[ ()
	{
		PauseFollowingPath();
		Delay(4, 5);
	}]

	CoverWestBank[ ()
	{

		if(Level.saved_IsCoverTrue = 0)
		{
			Level.Log("        IsCoverTrue = 0");
			Level.saved_IsCoverTrue = 1;
			Level.Log("        setting IsCoverTrue = 1");
			SetState_Patrol(0);
			SetAttackDistance(10, 4);
			SetLineOfSight(1,120);
			SetWander(0);
			Level.GetPlayer().PlaySound(74, 100, true);
			Level.Log("        I am now patrolling");
		}
		else
		{
			Level.Log("	IsCoverTrue != 0");
		}
	}]


	GoForCover[ ()
	{
		Delay(1, 7);  Level.Log("%%% Calling Price DELAY 7 %%%");
		FollowPath("Price_Attack_North", 0);
		FollowPathCallback(2, "WaitForClear");
		FollowPathCallback(5, "CoverWestBank");
	}]

//	GoForCover2[ ()
//	{
//		SetState_Idle();
//		FollowPath("Price_Retreat");
//		FollowPathCallback(127, "GoPathTankSupport");
//	}]

	GoPathAttackWest[ ()
	{
		//FollowPath
		return;
	}]

	GoPathTankSupport[ ()
	{
		FollowPath("Tank_Support_1",0);
		FollowPathCallback(4, "RunGun");
	}]

	RunGun[ ()
	{
		PauseFollowingPath();
		SetState_Patrol(0);
		SetAttackDistance(20, 10);
		SetLineOfSight(1,120);
		SetWander(0);
		Delay(6, 6);  Level.Log("%%% Calling Price DELAY 6 %%%");
	}]

	EBAttack[ ()
	{
		Level.saved_MortarsFired = 1;
		Delay(0, 3);
	}]

	EndOfPath[ ()
	{
		PauseFollowingPath();
		PlayAnimation(13);
	}]

	BombsAway[ (xPos, yPos, zPos)
        {
	        PlaySound(3,100,true);
	        Level.CreateEffect(55,61,0,xPos,yPos,zPos,128,14,72,72);

	        Level.GetPlayer().ShakeHere( xPos, yPos );
	        Level.GetPlayer().DamageHere( xPos, yPos,250,8 );

	        BombTime = Random(1,2);
	        Delay(BombTime,7); 	Level.Log("%%% Calling Price DELAY 7 %%%");
	}]

	BombsAway2[ (xPos2, yPos2, zPos2)
        {
	        PlaySound(3,100,true);
	        Level.CreateEffect(55,61,0,xPos2,yPos2,zPos2,128,14,72,72);

	        Level.GetPlayer().ShakeHere( xPos2, yPos2 );
	        Level.GetPlayer().DamageHere( xPos2, yPos2,250,8 );

	        BombTime = Random(1,2);
	        Delay(BombTime, 7);	Level.Log("%%% Calling Price DELAY 7 %%%");
	}]

	PrepareRetreat[()
	{
		saved_RetreatDone=1;
		saved_Fallback=1;
	}]
	
	GoOnAlert[()
	{
		StopFollowingPath();
		SetState_Patrol(0);
		SetAttackDistance(20, 10);
		SetLineOfSight(1,190);
		SetWander(0);
	}]
}