{
	saved_game [0]
	saved_levelloaded [0]

	saved_InZone_ZR_GR01 [0]
	saved_InZone_ZR_GR02 [0]
	saved_InZone_ZoneGRun01 [0]
	saved_InZone_ZoneGRun02 [0]
	saved_InZone_Kill_A_Tank [0]
	saved_InZone_Zone_GR03_04 [0]
	saved_InZone_City_Court01 [0]
	saved_InZone_ZoneGrunABC [0]
	saved_InZone_ZoneCityB [0]
	
	saved_NumObjectives [1]
	saved_CurObjective [0]


	Init[ ()
	{

		if( saved_game = 0 )
		{
			saved_game = 1;

			AddObjective( 214, 43776, 36437);
			SetObjectiveActive(0, true);

			AddObjective( 215, 12016, 23200);
			SetObjectiveActive(1, false);

			flakTrigger = AddTrigger("MyFlakTrigger");
			flakTrigger.SetCallback("FlakHasBeenKilled");
			flakTrigger.SetEntityID(49);

			// change to match the flakEntityID from entities.txt

			flakTrigger.SetLimit(1);

			Player = GetPlayer();
			Player.SetEntityDamage(1024);
			Player.SetEntityHealth(20000);
			SetTank(183);

			Player.SetInvulnerable(false);
			Player.SetWeaponAttach(97);
			Player.SetNationality(2);
			Player.SetFrozen(false);
			// Player.GiveWeapon(57);
			// Player.SetWeaponAttach(97);
			
			// eTank01 = GetEntity("ETank01");
			// eTank01.Delay(8,26);

			AutoSave();
		}
	}]
	
	OnLevelLoad[()
	{
		PlayAmbient(115);
		
		if(saved_levelloaded = 0)
		{
			saved_levelloaded = 1;
			SetMessage(516,75,35);
			SetMessage2(543,75,65);
			SetMessage3(517,75,80);
			
			Tank = GetEntity("A_Tank");
			Tank.Delay(3,5);			
		}	
	}]
	
	AdvanceObjectives[ (hideLast)
	{
		if( saved_CurObjective < saved_NumObjectives )
		{
			NextObj = (saved_CurObjective+1);
			DropObj = (saved_CurObjective-2);

			ObjectiveComplete( saved_CurObjective );

			if( NextObj < saved_NumObjectives )
			{
				if( hideLast = 1 )
				{
					SetObjectiveActive( saved_CurObjective, false );
				}

				SetObjectiveActive( NextObj, true );

				if( Level.saved_CurObjective > 1 )
				{
					Level.SetObjectiveActive( NextObj, true );
					if( hideLast = 0 )
					{	
						Level.SetObjectiveActive( DropObj, false );
					}
				}
			}
			saved_CurObjective = NextObj;
		}
	}]

	FlakHasBeenKilled[ ()
	{
		Log("Flak Killed");
		ObjectiveComplete(1);
		Victory();
		gVick = GetEntity("Gvick");
		gVick.Delay(8,30);
	}]

	EnterZone[ (whichZone)
	{
		if(whichZone = "tank1")
		{
			eTank01 = GetEntity("ETank01");
			eTank01.Delay(8,26);
		}
		if(whichZone = "tank23")
		{
			eTank02 = GetEntity("ETank02");
			eTank02.Delay(10,20);
			eTank03 = GetEntity("ETank03");
			eTank03.Delay(10,21);
		}
		if(whichZone = "tank4")
		{
			eTank04 = GetEntity("ETank04");
			eTank04.Delay(5,24);
		}
		if(whichZone = "tank5")
		{
			eTank05 = GetEntity("ETank05");
			eTank05.Delay(10,22);
		}
		if(whichZone = "tank6")
		{
			eTank06 = GetEntity("ETank06");
			eTank06.Delay(10,25);
		}
		if(whichZone = "ZR_GR01")
		{
			if( saved_InZone_ZR_GR01 = 0 )
			{
			        saved_InZone_ZR_GR01 = 1;
			        r_GR01 = GetEntity("R_GR01");
			        r_GR01.GoPath("PathGrunt01", 0);
				p_GR01 = GetEntity("P_GR01");
			}
		}
		if(whichZone = "ZR_GR02")
		{
			if( saved_InZone_ZR_GR02 = 0 )
			{
			        saved_InZone_ZR_GR02 = 1;

			        r_GR02 = GetEntity("R_GR02");
			        r_GR02.GoPath("PathGrunt02", 0);
			}
		}
		if(whichZone = "Kill_A_Tank")
		{
			if( saved_InZone_Kill_A_Tank = 0 )
			{
			        saved_InZone_Kill_A_Tank = 1;

				Tank = GetEntity("A_Tank");
			        Tank.Kill("A_Tank");
				r_GR0A = GetEntity("R_GR0A");
				r_GR0A.GoPath("PathGrunt0A", 0);
			}
		}
		if(whichZone = "ZoneGRun01")
		{
			if( saved_InZone_ZoneGRun01 = 0 )
			{
			        saved_InZone_ZoneGRun01 = 1;

			        r_GRun01 = GetEntity("GRun01");
			        r_GRun01.GoPath("PRun01", 0);
			        r_GRun02 = GetEntity("GRun02");
			        r_GRun02.GoPath("PRun02", 0);
			}
		}
		if(whichZone = "ZoneGRun02")
		{
			if( saved_InZone_ZoneGRun02 = 0 )
			{
			        saved_InZone_ZoneGRun02 = 1;

			        r_GRun03 = GetEntity("GRun03");
			        r_GRun03.GoPath("PRun03", 0);
			        r_GRun04 = GetEntity("GRun04");
			        r_GRun04.GoPath("PRun04", 0);
			        // eTank04 = GetEntity("ETank04");
			        // eTank04.Kill("ETank04");
			}
		}
		if(whichZone = "Zone_GR03_04")
		{
			if( saved_InZone_Zone_GR03_04 = 0 )
			{
			        saved_InZone_Zone_GR03_04 = 1;

			        r_GR03 = GetEntity("R_GR03");
			        r_GR03.GoPath("P_GR03", 0);
			        r_GR04 = GetEntity("R_GR04");
			        r_GR04.GoPath("P_GR04", 0);
			}
		}
		if(whichZone = "City_Court01")
		{
			if( saved_InZone_City_Court01 = 0 )
			{
			        saved_InZone_City_Court01 = 1;

			        cGrun01 = GetEntity("CGrun01");
			        cGrun01.GoPath("City_GR01", 0);
			        cTank01 = GetEntity("CTank01");
			        cTank01.GoPath("E_City01Tank", 2);
			        cTank02 = GetEntity("CTank02");
			        cTank02.GoPath("E_City02Tank", 2);
			}
		}

		if(whichZone = "ZoneGrunABC")
		{
			if( saved_InZone_ZoneGrunABC = 0 )
			{
			        saved_InZone_ZoneGrunABC = 1;

				gRunA = GetEntity("GRunA");
				gRunA.GoPath("GRun_PathA", 0);
				gRunB = GetEntity("GRunB");
				gRunB.GoPath("GRun_PathB", 0);
				gRunC = GetEntity("GRunC");
				gRunC.GoPath("GRun_PathC", 0);
			}

		}
		if(whichZone = "ZoneCityB")
		{
			if( saved_InZone_ZoneCityB = 0 )
			{
			        saved_InZone_ZoneCityB = 1;

				dGrun01 = GetEntity("DGrun01");
				dGrun01.GoPath("DGrun01", 0);
				dGrun02 = GetEntity("DGrun02");
				dGrun02.GoPath("DGrun02", 0);
				d_TankA = GetEntity("D_TankA");
				d_TankA.GoPath("DP_TankA", 2);
			}
		}
		if(whichZone = "cityenter")
		{
			AdvanceObjectives(0);
			//SetObjectiveActive(0,false);
			// SetObjectiveComplete(0);
			SetObjectiveActive(1, true);
			// NewObjectiveXY( 1, 12016, 23200 );
		}
		if(whichZone = "etankd")
		{
			eTankD = GetEntity("ETankD");
		        eTankD.GoPath("P_CityTank02", 2);
		}

	}]

	ActorKilled[ (whichActor)
	{

		if(whichActor = "ETank01")
		{
			eTank01 = GetEntity("ETank01");

			if( eTank01.IsDead() )
			{
				eTank01.Delay( 4, 100 );
				Tank = GetEntity("A_Tank");
				Tank.Delay(0,7);
				// eTank02 = GetEntity("ETank02");
				// eTank02.Delay(10,20);
				// eTank03 = GetEntity("ETank03");
				// eTank03.Delay(10,21);
				Tank.OneDownSound();
			}
		}
		if(whichActor = "ETank02")
		{
			eTank02 = GetEntity("ETank02");
			eTank03 = GetEntity("ETank03");
			eTank02.Delay( 4, 100 );
			if( eTank02.IsDead() and eTank03.IsDead() )
			{
				Tank = GetEntity("A_Tank");
				Tank.Delay(3,8);
				Tank.DeathSound();
			}
		}
		if(whichActor = "ETank03")
		{
			eTank02 = GetEntity("ETank02");
			eTank03 = GetEntity("ETank03");
			eTank03.Delay( 4, 100 );
			if( eTank02.IsDead() and eTank03.IsDead() )
			{
				Tank = GetEntity("A_Tank");
				Tank.Delay(3,8);
				// eTank04 = GetEntity("ETank04");
				// eTank04.Delay(5,24);
				Tank.DeathSound();
			}
		}
		if(whichActor = "ETank04")
		{
			eTank04 = GetEntity("ETank04");
			if( eTank04.IsDead() )
			{
				eTank04.Delay( 4, 100 );
				Tank = GetEntity("A_Tank");
				Tank.Delay(1,9);
				// eTank05 = GetEntity("ETank05");
				// eTank05.Delay(10,22);
				Tank.DeathSound();
			}
		}
		if(whichActor = "ETank05")
		{
			eTank05 = GetEntity("ETank05");
			if( eTank05.IsDead() )
			{
				eTank05.Delay( 4, 100 );
				Tank = GetEntity("A_Tank");
				Tank.Delay(0,11);
				Tank.DeathSound();
			}
		}
		if(whichActor = "ETank06")
		{
			eTank06 = GetEntity("ETank06");
			if( eTank06.IsDead() )
			{
				eTank06.Delay( 4, 100 );
			}
		}
		if(whichActor = "CTank01")
		{
			GetEntity("CTank01").Delay(4, 100);
		}
		if(whichActor = "CTank02")
		{
			GetEntity("CTank02").Delay(4, 100);
		}
		if(whichActor = "ETankD")
		{
			GetEntity("ETankD").Delay(4, 100);
		}
		if(whichActor = "D_TankA")
		{
			GetEntity("D_TankA").Delay(4, 100);
		}



		// ROBERT - Commented out becuase Objectives these actors
		// ROBERT - refer to are no longer pertinent to objectives.

		// if(whichActor = "Pan1")
		// {
		// 	pan1 = GetEntity("Pan1");
		// 	if( pan1.IsDead() )
                //
		// 	{
		// 		// 1/5
                //
		// 		SetObjectiveActive(2,true);
		// 		SetObjectiveActive(1,false);
                //
		// 	}
		// }
                //
		// if(whichActor = "Pan2")
		// {
		// 	pan2 = GetEntity("Pan2");
		// 	if( pan2.IsDead() )
                //
		// 	{
                //
		// 		// 2/5
		// 		SetObjectiveActive(3,true);
		// 		SetObjectiveActive(2,false);
		// 	}
		// }
		// if(whichActor = "Pan3")
		// {
		// 	pan3 = GetEntity("Pan3");
		// 	if( pan3.IsDead() )
                //
		// 	{
                //
		// 		// 3/5
		// 		SetObjectiveActive(4,true);
		// 		SetObjectiveActive(3,false);
		// 	}
		// }
		// if(whichActor = "Pan4")
		// {
		// 	pan4 = GetEntity("Pan4");
		// 	if( pan4.IsDead() )
                //
		// 	{
                //
		// 		// 4/5
		// 		SetObjectiveActive(5,true);
		// 		SetObjectiveActive(4,false);
		// 	}
		// }
		// if(whichActor = "Pan5")
		// {
		// 	pan5 = GetEntity("Pan5");
		// 	if( pan5.IsDead() )
                //
		// 	{
		// 		// 5/5
		// 		SetObjectiveActive(5,false);
		// 		SetObjectiveActive(6,true);
		// 		ObjectiveComplete(6);
		// 		SetObjectiveActive(7,true);
		// 	}
		// }

	}]


}