{
	target ["NULL"]
	saved_game [0]

	Init[ (s)
	{
		SetNationality(2);
		SetLineOfSight(2,90);
		SetAttackDistance(15,15);
				
		if( saved_game = 0 )
		{
			saved_game = 1;
			SetInvulnerable(true);
		}
	} ]

	DelayReached[ (ID)
	{
		if( ID=5 )
		{
			Level.Log("Enter Delay 5");
			PlaySound(100);
			Delay(3,6);
			Level.Log("Exit Delay 5");
		}
		if( ID=6 )
		{
			GoPath("A_TankStart", 1);

		}
		if( ID=7 )
		{
			TurretTurnTo(24448 ,10384 );
			GoPath("A_TankBridge", 2);
		}
		if( ID=8 )
		{
			TurretTurnTo(17776 ,5520 );
			GoPath("A_TankVally_A", 3);
		}
		if( ID=9 )
		{
			TurretTurnTo(13120 ,5488 );
			GoPath("A_TankVally_B", 5);
		}
		if( ID=11 )
		{
			
			TurretTurnTo(30336 ,1984 );
			GoPath("A_TankVally_C", 6);
		}


		if( ID=10 )
		{
			mytarget = self.target;
			FireNear( mytarget );
		}

	}]

	GoPath[ (Path, Mode)
	{
		Level.Log("-->  GoPath:  " # Path # ", " # Mode);
		FollowPath(Path, 0);

		switch(Mode)
		{
			case 1
			{
				FollowPathCallback( 127, "FireNear", "ETank01" );
			}
			case 2
			{
				FollowPathCallback( 127, "FireNear", "ETank02" );
			}
			case 3
			{
				FollowPathCallback( 127, "FireNear", "ETank03" );
			}
			case 4
			{
				FollowPathCallback( 127, "FireNear", "ETank04" );
			}
			case 5
			{
				FollowPathCallback( 127, "FireNear", "ETank05" );
			}
			case 6
			{
				FollowPathCallback( 127, "FireNear", "ETank06" );
			}
		}
	}]


	FireNear[ (Who)
	{
		Level.Log("Enter fire Near");
		Level.Log("        Who( FireNear ):  " # Who);
		Level.Log("        Gettting Entity:  " # Who);
		Monkey = Level.GetEntity(Who);

		if( not Monkey.IsDead() )
		{
			Xpos = Monkey.GetPositionX();
			Ypos = Monkey.GetPositionY();
			Xoff = Random(-3500, 3500);
			Yoff = Random(-3500, 3500);
			Xpos = (Xpos + Xoff);
			Ypos = (Ypos + Yoff);
	
			TurretShootAt(Xpos, Ypos);
			Level.Log("        FIRE!!!!");
	
			Who = Monkey.GetID();
			Level.Log("        Who (before Repeat):  " # Who);
			RepeatFire(Who);
			Level.Log("Exit fire Near");
		}
		else
		{
			Level.Log("FireNear() aborted, target is dead.");
		}

	}]


	RepeatFire[ (Who)
	{
		Level.Log("Enter Repeat fire");
		Level.Log("        Who (before):  " # Who);
		Who = Level.GetEntity(Who);
		Level.Log("        Who (after):  " # Who);

		if( not Who.IsDead())
		{
			whatever = Who.IsDead();
			Level.Log("        TankDead?  " # whatever);
			Level.Log("        Target (before):  " # self.target);
			Who = Who.GetID();
			self.target = Who;
			Level.Log("        Target (after):  " # self.target);
			Delay(5,10);
		}
		Level.Log("Exit Repeat fire");
	}]
	DeathSound[ ()
	{
		Sound = Random(1,2);
		switch(Sound)
		{
			case 1 { Level.GetPlayer().PlaySound(97); } // MP44
			case 2 { Level.GetPlayer().PlaySound(98); } // Kar98k
		}
	}]
	OneDownSound[ ()
	{
			Level.GetPlayer().PlaySound(101);
	}]


}