{
	Init[ ()
	{
		SetID("Captain");
		GiveWeapon(196);
	}]

	DelayReached[ (dy)
	{
		Level.Spew(" ");
		Level.Spew("<<<< Captain Delay >>>>");

		if( dy=10 )
		{
			Level.Spew("   10 - Boatmaster speach");

			player = Level.GetPlayer();
			player.PlaySound(109,100,0); // Boatmaster speach

			Level.Spew("        --> Delay(15)");
			return;
		}

		if( dy=30 )
		{
			Level.Spew("   30 - Unduck long");
			CrewDuck(0,1,0);
			return;
		}
		if( dy=35 )
		{
			Level.Spew("   35 - Unduck");
			CrewDuck(0,0,0);
			return;
		}

		if( dy=40 )
		{
			Level.Spew("   40 - Out of Boat!");
			PlaySound(113,100,0);

			Level.Spew("   40 - Delay(41)");
			Delay(4,41);
			return;
		}
		if( dy=41 )
		{
			Level.Spew("   41 - Next level");
			NextLevel();
			return;
		}
	}]

	CrewDuck[ (mode, speed, standDelay)
	{
		rider1 = Level.GetEntity("r1");
		rider2 = Level.GetEntity("r2");
		rider3 = Level.GetEntity("r3");
		rider4 = Level.GetEntity("r4");
		rider5 = Level.GetEntity("r5");
		rider6 = Level.GetEntity("r6");

		if( mode=1 )
		{
			// Duck
			rider1.PlayAnimationOffset(1,1,2);
			rider2.PlayAnimationOffset(1,1,2);
			rider3.PlayAnimationOffset(1,1,2);
			rider4.PlayAnimationOffset(1,1,2);
			rider5.PlayAnimationOffset(1,1,2);
			rider6.PlayAnimationOffset(1,1,2);

			if( speed=1 )
			{
				Delay( standDelay, 30 );
			}
			else
			{
				Delay( 2, 35 );
			}

		}
		else
		{
			// Stand Idle
			rider1.PlayAnimationOffset(3,1,0);
			rider2.PlayAnimationOffset(3,1,0);
			rider3.PlayAnimationOffset(3,1,0);
			rider4.PlayAnimationOffset(3,1,0);
			rider5.PlayAnimationOffset(3,1,0);
			rider6.PlayAnimationOffset(3,1,0);

			if( speed=1 )
			{
				Delay(4, 40);
			}
		}
	}]

	NextLevel[()
	{
		Level.LoadLevel("S_RUM1_RedSquare");
	}]
}