{
	saved_yet [0]

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

			SetWalking();

			SetNationality(1);
			GiveWeapon(53); // Kar98
			DropWeaponOnDeath( false );

			SetID( "dude" # Level.saved_Bridge_NumSpawn);
			TakeBridge();
		}
	}]

	DelayReached[ (dy)
	{
		if( dy=10 )
		{
			if (Level.saved_AtBridge = 0 )
			{
				SetState_Idle();
			} else {
				Delay(5,10);
			}
		}
		if( dy=20 )
		{
			DistractPlayer(0);
		}
	}]

	OnDecay[()
	{
		DestroyObject( self );
	}]

	TakeBridge[ ()
	{
		if( not self.IsDead() )
		{
			if( Level.saved_Bridge_LastPath = 0 )
			{
				// take path bbattle02
				Level.saved_Bridge_LastPath = 1;
				FollowPath( "bbattle02" );
				// FollowPathCallback( 3, "DistractPlayer", 1);
				FollowPathCallback( 5, "DistractPlayer", 1);
				FollowPathCallback( 6, "DistractPlayer", 1);
				FollowPathCallback( 7, "DistractPlayer", 1);
				FollowPathCallback( 127, "FailBridge", 1 );
			}
			else
			{
				// take path bbattle01
				Level.saved_Bridge_LastPath = 0;
				FollowPath( "bbattle01" );
				// FollowPathCallback( 3, "DistractPlayer", 1);
				// FollowPathCallback( 5, "DistractPlayer", 1);
				FollowPathCallback( 6, "DistractPlayer", 1);
				FollowPathCallback( 127, "FailBridge", 1 );
			}
		}
		Level.GetEntity("sarge").Delay(7,20);
	}]

	FailBridge[ (mode)
	{
		Level.saved_Bridge_NumEnd = (Level.saved_Bridge_NumEnd + 1);
		FailCnt = toInt(Level.saved_Bridge_NumEnd);

		if( FailCnt > Level.Bridge_MaxEnd )
		{
			ShootPlayer();
			Level.GetPlayer().Kill();
		}
		else
		{
			if( mode = 0 )
			{
				FollowPath( "bbattle02b" );
			} else 	{
				FollowPath( "bbattle01b" );
			}
			FollowPathCallback( 127, "ShootPlayer");
		}
	}]

	ShootPlayer[ ()
	{
		StopFollowingPath();
		PlayAnimation(13);
		TurnToEntity( Level.GetPlayer() );
		Attack( Level.GetPlayer() );
		Delay(5,10);
	}]

	DistractPlayer[ (toggle)
	{
		switch( toggle )
		{
			case 0
			{
				SetState_Idle();
				ResumeFollowingPath();
				return;
			}
			case 1
			{
				PauseFollowingPath();
				TurnToEntity( Level.GetPlayer() );

				OnlyAttackPlayer( true );
				SetState_Attack(0);
				SetAttackDistance(40,10);
				SetLineOfSight(0);
				SetWander(0);
				Delay(5,20);
				return;
			}
		}
	}]
}