{
	saved_FirstTime [1]

	saved_anim_runFlag [30]
	saved_anim_runArmed [0]
	saved_anim_runUnarmed [32]
	saved_anim_deathStandFwd [17]

	saved_pathRed[0]
	saved_pathRedEnd[9]
	saved_pathGreen[1]
	saved_pathGreenEnd[10]
	saved_pathBlue[2]
	saved_pathBlueEnd[9]
	saved_pathYellow[3]
	saved_pathYellowEnd[8]
	saved_pathPink[4]
	saved_pathPinkEnd[11]
	saved_pathCyan[5]
	saved_pathCyanEnd[8]

	saved_dudeType[1]

	Init[ (s)
	{
		if(saved_FirstTime = 1)
		{
			saved_FirstTime = 0;
			SetRunning();
			SetNationality(3);
			if( Level.saved_NumRunners = 3 )
			{
				saved_dudeType = 1;
			}
			else
			{
				ArmMe = Random(0,1);
				if( ArmMe = 1 )
				{
					if( Level.saved_NumArmed < Level.saved_MaxArmed )
					{
						saved_dudeType = 2;
						Level.saved_NumArmed = Level.saved_NumArmed + 1;
					}
					else
					{
						saved_dudeType = 3;
					}
				}
				else
				{
					saved_dudeType = 3;
				}
			}

			strongMan = Random(0,1);
			if( strongMan = 0 )
			{
				saved_pathRedEnd = Random(0,9);
				saved_pathGreenEnd = Random(0,10);
				saved_pathBlueEnd = Random(0,9);
				saved_pathYellowEnd = Random(0,8);
				saved_pathPinkEnd = Random(0,11);
				saved_pathCyanEnd = Random(0,8);
			}
		}
	}]

	Spawn[ ()
	{
		Level.saved_NumRunners = Level.saved_NumRunners + 1;
		RunForest = Level.CreateEntity(80,6912,1056,256);
		RunForest.SetID("Runner");
		RunForest.Reset();
	}]

	Reset[ ()
	{
		switch( saved_dudeType )
		{
			case 1 { GiveWeapon(83); DropWeaponOnDeath( false ); SetRunningAnim(saved_anim_runFlag); PlayAnimation(saved_anim_runFlag); }
			case 2 { GiveWeapon(56); DropWeaponOnDeath( true ); SetRunningAnim(saved_anim_runArmed); PlayAnimation(saved_anim_runArmed); }
			case 3 { SetRunningAnim(saved_anim_runUnarmed); PlayAnimation(saved_anim_runUnarmed);	}
		}

		SpawnPoint = Random(1,3);
		while ( SpawnPoint = Level.saved_LastSpawn )
		{
			SpawnPoint = Random(1,3);
		}
		Level.saved_LastSpawn = SpawnPoint;

		switch( SpawnPoint )
		{
			case 1 { SetPosition( Random(4600,8600), 1000, 256 ); }
			case 2 { SetPosition( 864,4864,512 ); }
			case 3 { SetPosition( 13152,3744,256 ); }
		}

		SetDead( false, 0 );
		Run( SpawnPoint );
	}]

	Run[ (SpawnPoint)
	{
		switch( SpawnPoint )
		{
			case 1 { Route = Random(2,4); }
			case 2 { Route = 1; }
			case 3 { Route = Random(5,6); }
		}

		switch( Route )
		{
			case 1 { FollowPath("PinkPath"); }
			case 2 { FollowPath("BluePath"); }
			case 3 { FollowPath("GreenPath"); }
			case 4 { FollowPath("RedPath"); }
			case 5 { FollowPath("YellowPath"); }
			case 6 { FollowPath("CyanPath"); }
		}
	}]

	FakeKill[ ()
	{
		xPos = self.GetPositionX();
		yPos = self.GetPositionY();
		zPos = self.GetPositionZ();
		zPos = toInt(zPos + 64); // Old offset: 325

		MorterDeath = Random(0,1);
		if( MorterDeath = 1 )
		{
			StopFollowingPath();
			PlayAnimation(25,127,0);
			PlaySound(3,100,true);
			Level.CreateEffect(55,61,0,xPos,yPos,zPos,128,14,72,72);
			if( Level.saved_MortarShake = 1 )
			{
				Level.GetPlayer().ShakeHere( xPos, yPos );
				Level.GetPlayer().DamageHere( xPos, yPos, 3000, 8 );
			}
		}
		else
		{
			StopFollowingPath();
			PlayAnimation(17,127,0);
		}

		PlaySound(9,100,true);
		StopFollowingPath();
		SetDead( true, Random(2,5) );

		if( self.saved_dudeType = 2 )
		{
			Level.CreateEntity(96,xPos,yPos,zPos);
		}
	}]

	PathNodeReached[ (id, nodeId)
	{
		Level.saved_SpaceCnt = Level.saved_SpaceCnt + 1;

		if( id=saved_pathRed ){if( nodeId=saved_pathRedEnd ){ FakeKill(); }}
		if( id=saved_pathBlue ){if( nodeId = saved_pathBlueEnd ){ FakeKill(); }}
		if( id=saved_pathGreen ){if( nodeId=saved_pathGreenEnd ){ FakeKill(); }}
		if( id=saved_pathPink ){if( nodeId=saved_pathPinkEnd ){ FakeKill(); }}
		if( id=saved_pathYellow ){if( nodeId=saved_pathYellowEnd ){ FakeKill(); }}
		if( id=saved_pathCyan ){if( nodeId=saved_pathCyanEnd ){ FakeKill(); }}

		if( Level.saved_Onslaught = 1 )
		{
			if( Level.saved_NumRunners <= Level.saved_MaxRunners )
			{
				if( Level.saved_SpaceCnt >= Level.saved_Spacing )
				{
					Level.saved_SpaceCnt = 0;
					Spawn();
				}
			}
		}
	}]

	OnDecay[ ()
	{
		Reset();
	}]
}