Botpack
Class TrainingAS

source: e:\games\UnrealTournament\Botpack\Classes\TrainingAS.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Info
         |
         +--Engine.GameInfo
            |
            +--Botpack.TournamentGameInfo
               |
               +--Botpack.DeathMatchPlus
                  |
                  +--Botpack.TeamGamePlus
                     |
                     +--Botpack.Assault
                        |
                        +--Botpack.TrainingAS
Direct Known Subclasses:None

class TrainingAS
extends Botpack.Assault

//============================================================================= // TrainingAS. //=============================================================================
Variables
 string AS[13]
 LastEvent, EventIndex
 PlayerPawn Trainee
 string TutMessage[25]

States
ServerTravel

Function Summary
 void ASTutEvent0()
 void ASTutEvent1()
 void ASTutEvent10()
 void ASTutEvent11()
 void ASTutEvent12()
 void ASTutEvent2()
 void ASTutEvent3()
 void ASTutEvent4()
 void ASTutEvent5()
 void ASTutEvent6()
 void ASTutEvent7()
 void ASTutEvent8()
 void ASTutEvent9()
 void EndGame(string Reason)
 void InitRatedGame(LadderInventory LadderObj, PlayerPawn LadderPlayer)
 void Timer()
 void TutorialSound(string NewSound)


State ServerTravel Function Summary
 void BeginState()
 void Timer()



Source Code


00001	//=============================================================================
00002	// TrainingAS.
00003	//=============================================================================
00004	class TrainingAS extends Assault;
00005	
00006	#exec OBJ LOAD FILE=..\Sounds\TutVoiceAS.uax PACKAGE=TutVoiceAS
00007	
00008	var string AS[13];
00009	
00010	var PlayerPawn Trainee;
00011	
00012	var localized string TutMessage[25];
00013	
00014	var int EventTimer, LastEvent, EventIndex;
00015	
00016	// Parse options for this game...
00017	event InitGame( string Options, out string Error )
00018	{
00019		local string InOpt;
00020	
00021		Super.InitGame(Options, Error);
00022	
00023		bRatedGame = True;
00024		bRequireReady = False;
00025		bTournament = False;
00026		EventTimer = 3;
00027	
00028		bDontRestart = True;
00029	}
00030	
00031	function InitRatedGame(LadderInventory LadderObj, PlayerPawn LadderPlayer)
00032	{
00033		Super.InitRatedGame(LadderObj, LadderPlayer);
00034		
00035		RemainingBots = 0;
00036		bRequireReady = False;
00037	}
00038	
00039	event playerpawn Login
00040	(
00041		string Portal,
00042		string Options,
00043		out string Error,
00044		class<playerpawn> SpawnClass
00045	)
00046	{
00047		Trainee = Super.Login(Portal, Options, Error, SpawnClass);
00048		//Trainee.PlayerReplicationInfo.TeamName = "Red";
00049		//Trainee.PlayerReplicationInfo.Team = 0;
00050		Trainee.ReducedDamageType = 'All';
00051	
00052		return Trainee;
00053	}
00054	
00055	function TutorialSound( string NewSound )
00056	{
00057		local sound MySound;
00058	
00059		MySound = sound( DynamicLoadObject(NewSound, class'Sound') );
00060		EventTimer = GetSoundDuration( MySound ) + 2;
00061		Trainee.PlaySound(MySound, SLOT_Interface, 2.0);
00062	}
00063	
00064	function Timer()
00065	{
00066		Super.Timer();
00067	
00068		if (EventTimer == 0)
00069			return;
00070	
00071		EventTimer--;
00072		if (EventTimer == 0)		// Event time is up, perform an event
00073		{
00074			if (EventIndex == LastEvent)	// No more events queued.
00075				return;
00076			if (EventIndex == 11)
00077				EventTimer = 4;
00078	
00079			// Call an event function appropriate for this event.
00080			switch (EventIndex)
00081			{
00082				case 0:
00083					ASTutEvent0();
00084					break;
00085				case 1:
00086					ASTutEvent1();
00087					break;
00088				case 2:
00089					ASTutEvent2();
00090					break;
00091				case 3:
00092					ASTutEvent3();
00093					break;
00094				case 4:
00095					ASTutEvent4();
00096					break;
00097				case 5:
00098					ASTutEvent5();
00099					break;
00100				case 6:
00101					ASTutEvent6();
00102					break;
00103				case 7:
00104					ASTutEvent7();
00105					break;
00106				case 8:
00107					ASTutEvent8();
00108					break;
00109				case 9:
00110					ASTutEvent9();
00111					break;
00112				case 10:
00113					ASTutEvent10();
00114					break;
00115				case 11:
00116					ASTutEvent11();
00117					break;
00118				case 12:
00119					ASTutEvent12();
00120					break;
00121			}
00122			EventIndex++;
00123		}
00124	}
00125	
00126	function ASTutEvent0()
00127	{
00128		local FortStandard FS;
00129	
00130		Trainee.ProgressTimeOut = Level.TimeSeconds;
00131		foreach AllActors(class'FortStandard', FS)
00132		{
00133			if (FS.Tag == 'lickbird')
00134			{
00135				FS.bProjTarget = False;
00136				FS.bCollideWorld = False;
00137			}
00138		}
00139	
00140		TournamentConsole(Trainee.Player.Console).ShowMessage();
00141		TutorialSound(AS[0]);
00142		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[0]);
00143	
00144		Trainee.Health = 100;
00145	}
00146	
00147	function ASTutEvent1()
00148	{
00149		TutorialSound(AS[1]);
00150		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[1]);
00151	}
00152	
00153	function ASTutEvent2()
00154	{
00155		TutorialSound(AS[2]);
00156		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[2]);
00157	}
00158	
00159	function ASTutEvent3()
00160	{
00161		TutorialSound(AS[3]);
00162		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[3]);
00163	}
00164	
00165	function ASTutEvent4()
00166	{
00167		TutorialSound(AS[4]);
00168		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[4]);
00169	}
00170	
00171	function ASTutEvent5()
00172	{
00173		TutorialSound(AS[5]);
00174		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[5]);
00175	}
00176	
00177	function ASTutEvent6()
00178	{
00179		TutorialSound(AS[6]);
00180		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[6]);
00181	}
00182	
00183	function ASTutEvent7()
00184	{
00185		TutorialSound(AS[7]);
00186		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[7]);
00187	}
00188	
00189	function ASTutEvent8()
00190	{
00191		TutorialSound(AS[8]);
00192		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[8]);
00193	}
00194	
00195	function ASTutEvent9()
00196	{
00197		TutorialSound(AS[9]);
00198		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[9]);
00199	}
00200	
00201	function ASTutEvent10()
00202	{
00203		TutorialSound(AS[10]);
00204		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[10]);
00205	}
00206	
00207	function ASTutEvent11()
00208	{
00209		TutorialSound(AS[11]);
00210		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[11]);
00211	}
00212	
00213	function ASTutEvent12()
00214	{
00215		local FortStandard FS;
00216	
00217		foreach AllActors(class'FortStandard', FS)
00218		{
00219			if (FS.Tag == 'lickbird')
00220			{
00221				FS.bProjTarget = True;
00222				FS.bCollideWorld = True;
00223			}
00224		}
00225	
00226		bRatedGame = True;
00227		RemainingBots = RatedMatchConfig.NumBots; 
00228	
00229		TournamentConsole(Trainee.Player.Console).HideMessage();
00230	}
00231	
00232	function EndGame( string Reason )
00233	{
00234		Super.EndGame(Reason);
00235	
00236		if (SuccessfulGame())
00237			TutorialSound(AS[12]);
00238		else
00239			Trainee.ClientPlaySound(sound'Announcer.LostMatch', True);
00240	
00241		if (RatedGameLadderObj != None)
00242		{
00243			RatedGameLadderObj.PendingChange = 0;
00244			RatedGameLadderObj.LastMatchType = LadderTypeIndex;
00245			if (RatedGameLadderObj.ASPosition < 1)
00246			{
00247				RatedGameLadderObj.PendingChange = LadderTypeIndex;
00248				RatedGameLadderObj.PendingRank = 1;
00249				RatedGameLadderObj.PendingPosition = 1;
00250			}
00251		}
00252		GoToState('ServerTravel');
00253	}
00254	
00255	state ServerTravel
00256	{
00257		function Timer()
00258		{
00259			local string StartMap;
00260	
00261			StartMap = "UT-Logo-Map.unr"
00262				$"?Game=Botpack.LadderTransition";
00263	
00264			Trainee.ClientTravel(StartMap, TRAVEL_Absolute, True);
00265		}
00266	
00267		function BeginState()
00268		{
00269			SetTimer(10.0, true);
00270		}
00271	}
00272	
00273	defaultproperties
00274	{
00275	     AS(0)="TutVoiceAS.as00"
00276	     AS(1)="TutVoiceAS.as01"
00277	     AS(2)="TutVoiceAS.as02"
00278	     AS(3)="TutVoiceAS.as03"
00279	     AS(4)="TutVoiceAS.as04"
00280	     AS(5)="TutVoiceAS.as05"
00281	     AS(6)="TutVoiceAS.as06"
00282	     AS(7)="TutVoiceAS.as07"
00283	     AS(8)="TutVoiceAS.as08"
00284	     AS(9)="TutVoiceAS.as09"
00285	     AS(10)="TutVoiceAS.as10"
00286	     AS(11)="TutVoiceAS.as11"
00287	     AS(12)="TutVoiceAS.as12"
00288	     TutMessage(0)="Welcome to Assault combat training. This tutorial will instruct you on the basic rules of AS. Tutorials on DeathMatch, Domination, and Capture the Flag are also available."
00289	     TutMessage(1)="The first thing you'll notice upon entering an Assault game is the large digital time display to the left of your HUD. This timer counts away the seconds until the game ends. Time is critical in an Assault game."
00290	     TutMessage(2)="The game consists of two teams, each with a unique goal. You are on the attacking team. Your job is to penetrate the enemy base and destroy several key locations. If you fail to succeed in the allotted time, you lose."
00291	     TutMessage(3)="The opposing team are the defenders. The defender's job is to protect their base and key locations from the assaulting team."
00292	     TutMessage(4)="If you succeed in taking the enemy base as an attacker, then you must play the role of the defender for the same length of time."
00293	     TutMessage(5)="To clarify, if you have 20 minutes to take the enemy base and you succeed in 10, then the map will restart and you must defend the base for 10 minutes. The longer it takes you to succeed in attacking, the longer you must defend the base."
00294	     TutMessage(6)="Each assault map is unique in design. It may take time to learn the layout and develop strategies to attack or defend successfully."
00295	     TutMessage(7)="At the start of every match, you are in spectator mode. Feel free to fly around and explore the map before play begins, to familiarize yourself with the environment."
00296	     TutMessage(8)="When playing Assault with bots, you can use the 'orders menu' to command bot behavior. By hitting the v key, you can access the orders menu and deploy bots as you see fit."
00297	     TutMessage(9)="The goal of this tutorial map is to break into the enemy base and destroy a prototype plasma tank. I'm going to summon two enemy bots to try and stop you, but you'll have a buddy to assist."
00298	     TutMessage(10)="Some explosive has been set on the cave wall near the enemy base. Use your weapon to light the fuse then get back! Use the breach the explosive creates to enter the enemy base and take out the tank!"
00299	     TutMessage(11)="Watch out for the enemy bot guarding the base and plasma turrets. Good luck!"
00300	     TutMessage(12)="Congratulations! You've succeeded in destroying the plasma tank. Now its time to enter the Assault Tournament Ladder."
00301	     LastEvent=13
00302	     SingleWaitingMessage=""
00303	     bTutorialGame=True
00304	     Difficulty=0
00305	     MapPrefix="AS-Tutorial"
00306	     BeaconName="AS-Tutorial"
00307	     GameName="Combat Training: AS"
00308	     bLoggingGame=False
00309	}

End Source Code