{
	debug_SkipToEnding [0]

	saved_FirstTime[0]
	saved_LevelLoad[0]

	saved_AtEnterMap [0]
	saved_AtEnterBuilding [0]
	saved_AtOnRoof [0]
	saved_AtRunZone00 [0]
	saved_AtRunZone01 [0]
	saved_AtRunZone02 [0]
	saved_AtRunZone03 [0]
	saved_AtRunZone04 [0]
	saved_AtRunZone05 [0]
	saved_AtRunZone06 [0]
	saved_AtRunZone07 [0]
	saved_AtRunZone08 [0]
	saved_AtRunZone09 [0]
	saved_AtRunZone10 [0]
	saved_AtGoTank [0]
	saved_AtStopTank [0]
	saved_AtEnterHall [0]
	saved_AtEnterHall2 [0]
	saved_AtGoBuddy1 [0]
	saved_AtGoBuddy2 [0]
	saved_AtGoBuddy3 [0]
	saved_AtGoBuddy4 [0]
	saved_AtGoJeff01 [0]
	saved_AtGoJeff03 [0]

	saved_NumObjectives [14]
	saved_CurObjective [0]


	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;
		}
	}]

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

			AddObjective( 153, 9588, 20108 );
			SetObjectiveActive( 0, true );

			AddObjective( 154, 16256, 27520 );
			SetObjectiveActive( 1, false );

			AddObjective( 155,  3712, 14464 );
			SetObjectiveActive( 2, false );

			AddObjective( 156, 19272, 4948 );
			SetObjectiveActive( 3, false );

			AddObjective( 157,  21688, 14208 );
			SetObjectiveActive( 4, false );

			AddObjective( 158,  19184,  25272 );
			SetObjectiveActive( 5, false );

			AddObjective( 159,  19184,  25272 );
			SetObjectiveActive( 6, false );

			AddObjective( 160, 39936, 12256 );
			SetObjectiveActive( 7, false );

			AddObjective( 161, 39712, 15136 );
			SetObjectiveActive( 8, false );

			// Yeah.. i wanna be able to see further :P
			//
			SetVis_RayLen( 64 ); // default is 32
			SetVis_RayWidth( 192 ); // default is 256

			player = GetPlayer();
			player.SetInvulnerable( false );
			player.SetNationality(3);	// Russian
			player.GiveWeapon(62,5);	// SMosNag
			player.GiveWeapon(60,5);	// MosNag
			player.GiveWeapon(61,8);	// RGD-33 Stick Grenade

			if( debug_SkipToEnding = 1 )
			{
				player.SetPosition(42112,17536,4392);
				player.SetRotationTurn(-17786);
				player.SetRotationPitch(0);
				player.SetRotationRoll(0);
			}

			AutoSave();
		}
	}]

	OnLevelLoad[ ()
	{
		PlayAmbient( 103 );

		if(saved_LevelLoad = 0)
		{
			saved_LevelLoad = 1;

			SetMessage(510,75,35);
			SetMessage2(538,75,65);
			SetMessage3(428,75,80);
		}
	}]

	EnterZone[ (zone)
	{
		if( zone="Gun01On"  ){ GetEntity("gun01").TakeGun(1); }
		if( zone="Gun01Off" ){ GetEntity("gun01").TakeGun(0); }
		if( zone="Gun02On"  ){ GetEntity("gun02").TakeGun(2); }
		if( zone="Gun02Off" ){ GetEntity("gun02").TakeGun(0); }
		if( zone="Gun03On"  ){ GetEntity("gun03").TakeGun(3); }
		if( zone="Gun03Off" ){ GetEntity("gun03").TakeGun(0); }

		if( zone="EnterMap" )
		{
			if( saved_AtEnterMap = 0 )
			{
				saved_AtEnterMap = 1;
				GetEntity("pat01").GoPath("RunHere01",0,0);
				GetEntity("pat02").GoPath("RunHere02",0,0);

				if( saved_AtGoBuddy4 = 0 )
				{
					player = GetPlayer();
					chum = GetEntity("buddy4");
					chum.GoPatrol();
					chum.FollowPath( "BuddyPath4", 0, player, 1, 2, 1, false );
					chum.FollowPathCallback( 127, "AttackFace", "grtank" );

					GetEntity("buddy5").GoPath("BuddyPath5",0,0);
				}
			}
		}
		if( zone="RunZone00" )
		{
			if( saved_AtRunZone00 = 0 )
			{
				saved_AtRunZone00 = 1;
				GetEntity("pat04").GoPath("RunHere04",0,0);
			}
		}
		if( zone="RunZone01" )
		{
			if( saved_AtRunZone01 = 0 )
			{
				saved_AtRunZone01 = 1;
				GetEntity("pat05").GoPath("RunHere05",0,0);
			}
		}
		if( zone="RunZone02" )
		{
			if( saved_AtRunZone02 = 0 )
			{
				saved_AtRunZone02 = 1;
				GetEntity("pat06").GoPath("RunHere06",0,0);
			}
		}
		if( zone="RunZone04" )
		{
			if( saved_AtRunZone04 = 0 )
			{
				saved_AtRunZone04 = 1;
				GetEntity("pat08").GoPath("RunHere08",0,0);
			}
		}
		if( zone="RunZone05" )
		{
			if( saved_AtRunZone05 = 0 )
			{
				saved_AtRunZone05 = 1;
				GetEntity("pat03").GoPath("RunHere03",0,0);
			}
		}
		if( zone="RunZone06" )
		{
			if( saved_AtRunZone06 = 0 )
			{
				saved_AtRunZone06 = 1;
				GetEntity("pat09").GoPath("RunHere09",0,0);
				GetEntity("pat10").GoPath("RunHere10",0,0);
			}
		}
		if( zone="RunZone07" )
		{
			if( saved_AtRunZone07 = 0 )
			{
				saved_AtRunZone07 = 1;
				GetEntity("pat11").GoPath("RunHere11",0,0);
				GetEntity("pat12").GoPath("RunHere12",0,0);
			}
		}
		if( zone="RunZone09" )
		{
			if( saved_AtRunZone09 = 0 )
			{
				saved_AtRunZone09 = 1;
				GetEntity("pat15").GoPath("RunHere15",0,0);
			}
		}
		if( zone="RunZone10" )
		{
			if( saved_AtRunZone10 = 0 )
			{
				saved_AtRunZone10 = 1;
				GetEntity("pat16").GoPath("RunHere16",0,0);
				GetEntity("pat17").GoPath("RunHere17",0,0);
			}
		}
		if( zone="EnterBuilding" )
		{
			if( saved_AtEnterBuilding=0 )
			{
				saved_AtEnterBuilding = 1;
				AdvanceObjectives(0);
			}
		}
		if( zone="EnterHall" )
		{
			if( saved_AtEnterHall = 0 )
			{
				saved_AtEnterHall = 1;
				GetEntity("pat18").GoPath("RunHere18",0,0);
				GetEntity("pat19").GoPath("RunHere19",0,0);
			}
		}
		if( zone="EnterHall2" )
		{
			if( saved_AtEnterHall2 = 0 )
			{
				saved_AtEnterHall2 = 1;
				GetEntity("pat20").GoPath("RunHere20",0,0);

			}
		}
		if( zone="OnRoof" )
		{
			if( saved_AtOnRoof=0 )
			{
				saved_AtOnRoof = 1;
				AdvanceObjectives(0);

				GetEntity( "frunr" ).RunFlag();
			}
		}
		if( zone="GoTank" )
		{
			if( saved_AtGoTank=0 )
			{
				saved_AtGoTank = 1;
				Level.GetEntity("tank").WalkTo(34048,12320);
				GetEntity("pat13").GoPath("RunHere13",0,0);
				GetEntity("pat14").GoPath("RunHere14",0,0);
			}
		}
		if( zone="StopTank" )
		{
			saved_AtStopTank = 1;
		}
		if( zone="GoBuddy1" )
		{
			if( saved_AtGoBuddy1 = 0 )
			{
				saved_AtGoBuddy1 = 1;

				player = GetPlayer();
				chum = GetEntity("buddy1");
				chum.GoPatrol();
				chum.FollowPath( "BuddyPath1", 0, player, 1, 2, 1, false );
			}
		}
		if( zone="GoBuddy2" )
		{
			if( saved_AtGoBuddy2 = 0 )
			{
				saved_AtGoBuddy2 = 1;

				player = GetPlayer();
				chum = GetEntity("buddy2");
				chum.GoPatrol();
				chum.FollowPath( "BuddyPath2", 0, player, 1, 2, 1, false );
			}
		}
		if( zone="GoBuddy3" )
		{
			if( saved_AtGoBuddy3 = 0 )
			{
				saved_AtGoBuddy3 = 1;

				player = GetPlayer();
				chum = GetEntity("buddy3");
				chum.GoPatrol();
				chum.FollowPath( "BuddyPath3", 0, player, 1, 2, 1, false );

				dude = GetEntity("jeff02");
				dude.GoPath("JeffPath02",0,0);
			}
		}
		if( zone="GoJeff01" )
		{
			if( saved_AtGoJeff01 = 0 )
			{
				saved_AtGoJeff01 = 1;

				chum = GetEntity("jeff01");
				chum.GoPath("JeffPath01",0,0);
			}
		}
		if( zone="GoJeff03" )
		{
			if( saved_AtGoJeff01 = 0 )
			{
				saved_AtGoJeff03 = 1;

				chum = GetEntity("jeff03");
				chum.GoPath("JeffPath03",0,0);
			}
		}

		if( zone="ViewDefault" )
		{
			SetVis_Default();
		}
		if( zone="ViewFar" )
		{
			SetVis_RayLen( 64 ); // default is 32
			SetVis_RayWidth( 192 ); // default is 256
		}
		if( zone="spladow" )
		{
			GetPlayer().PlaySound(176,100);
		}
	}]
}