Botpack
Class TrainingDOM

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

class TrainingDOM
extends Botpack.Domination

//============================================================================= // TrainingDOM. //=============================================================================
Variables
 string DOM[21]
 EventIndex, SoundIndex
 PlayerPawn Trainee
 string TranslocatorClass
 string TutMessage[21]
 bool bOldAutoTaunt
 bool bPause

States
of, ServerTravel, FreeRunning4, FreeRunning3, FreeRunning2, FreeRunning1

Function Summary
 void DOMTutEvent0()
 void DOMTutEvent1()
 void DOMTutEvent10()
 void DOMTutEvent2()
 void DOMTutEvent3()
 void DOMTutEvent4()
 void DOMTutEvent5()
 void DOMTutEvent6()
 void DOMTutEvent7()
 void DOMTutEvent8()
 void DOMTutEvent9()
 void InitRatedGame(LadderInventory LadderObj, PlayerPawn LadderPlayer)
 void Timer()
 void TutorialSound(string NewSound)


State of Function Summary


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


State FreeRunning4 Function Summary
 void EndGame(string Reason)
 bool SuccessfulGame()
 void DOMTutEvent18()
 void DOMTutEvent17()
 void DOMTutEvent16()
 void Tick(float DeltaTime)


State FreeRunning3 Function Summary
 void DOMTutEvent15()
 void Tick(float DeltaTime)


State FreeRunning2 Function Summary
 void DOMTutEvent14()
 void DOMTutEvent13()
 void Tick(float DeltaTime)


State FreeRunning1 Function Summary
 void DOMTutEvent12()
 void DOMTutEvent11()
 void Tick(float DeltaTime)



Source Code


00001	//=============================================================================
00002	// TrainingDOM.
00003	//=============================================================================
00004	class TrainingDOM extends Domination;
00005	
00006	#exec OBJ LOAD FILE=..\Sounds\TutVoiceDOM.uax PACKAGE=TutVoiceDOM
00007	
00008	var bool bOldAutoTaunt;
00009	
00010	var string DOM[21];
00011	
00012	var localized string TutMessage[21];
00013	
00014	var PlayerPawn Trainee;
00015	
00016	var int EventTimer, LastEvent, EventIndex, SoundIndex;
00017	var bool bPause;
00018	
00019	var string TranslocatorClass;
00020	
00021	// Parse options for this game...
00022	event InitGame( string Options, out string Error )
00023	{
00024		local string InOpt;
00025	
00026		Super.InitGame(Options, Error);
00027	
00028		bRatedGame = True;
00029		TimeLimit = 0;
00030		RemainingTime = 0;
00031		FragLimit = 0;
00032		bRequireReady = False;
00033		bTournament = False;
00034		EventTimer = 3;
00035	}
00036	
00037	function InitRatedGame(LadderInventory LadderObj, PlayerPawn LadderPlayer)
00038	{
00039		Super.InitRatedGame(LadderObj, LadderPlayer);
00040		
00041		RemainingBots = 0;
00042		bRequireReady = False;
00043		GoalTeamScore = 0;
00044	}
00045	
00046	event playerpawn Login
00047	(
00048		string Portal,
00049		string Options,
00050		out string Error,
00051		class<playerpawn> SpawnClass
00052	)
00053	{
00054		Trainee = Super.Login(Portal, Options, Error, SpawnClass);
00055		Trainee.PlayerReplicationInfo.TeamName = "Red";
00056		Trainee.PlayerReplicationInfo.Team = 0;
00057		Trainee.ReducedDamageType = 'All';
00058	
00059		return Trainee;
00060	}
00061	
00062	function TutorialSound( string NewSound )
00063	{
00064		local sound MySound;
00065	
00066		MySound = sound( DynamicLoadObject(NewSound, class'Sound') );
00067		EventTimer = GetSoundDuration( MySound ) + 2;
00068		Trainee.PlaySound(MySound, SLOT_Interface, 2.0);
00069	}
00070	
00071	function Timer()
00072	{
00073		Super.Timer();
00074	
00075		if ((EventTimer == 0) || bPause)
00076			return;
00077	
00078		EventTimer--;
00079		if (EventTimer == 0)		// Event time is up, perform an event
00080		{
00081			if (EventIndex == LastEvent)	// No more events queued.
00082				return;
00083	
00084			// Call an event function appropriate for this event.
00085			switch (EventIndex)
00086			{
00087				case 0:
00088					DOMTutEvent0();
00089					break;
00090				case 1:
00091					DOMTutEvent1();
00092					break;
00093				case 2:
00094					DOMTutEvent2();
00095					break;
00096				case 3:
00097					DOMTutEvent3();
00098					break;
00099				case 4:
00100					DOMTutEvent4();
00101					break;
00102				case 5:
00103					DOMTutEvent5();
00104					break;
00105				case 6:
00106					DOMTutEvent6();
00107					break;
00108				case 7:
00109					DOMTutEvent7();
00110					break;
00111				case 8:
00112					DOMTutEvent8();
00113					break;
00114				case 9:
00115					DOMTutEvent9();
00116					break;
00117				case 10:
00118					DOMTutEvent10();
00119					break;
00120				case 11:
00121					DOMTutEvent11();
00122					break;
00123				case 12:
00124					DOMTutEvent12();
00125					break;
00126				case 13:
00127					DOMTutEvent13();
00128					break;
00129				case 14:
00130					DOMTutEvent14();
00131					break;
00132				case 15:
00133					DOMTutEvent15();
00134					break;
00135				case 16:
00136					DOMTutEvent16();
00137					break;
00138				case 17:
00139					DOMTutEvent17();
00140					break;
00141				case 18:
00142					DOMTutEvent18();
00143					break;
00144			}
00145			EventIndex++;
00146		}
00147	}
00148	
00149	function DOMTutEvent0()
00150	{
00151		local ControlPoint CP;
00152	
00153		Trainee.ProgressTimeOut = Level.TimeSeconds;
00154		if (Trainee.IsA('TournamentPlayer'))
00155		{
00156			bOldAutoTaunt = TournamentPlayer(Trainee).bAutoTaunt;
00157			TournamentPlayer(Trainee).bAutoTaunt = False;
00158		}
00159		foreach AllActors(class'ControlPoint', CP)
00160		{
00161			CP.SetCollision(False, False, False);
00162		}
00163		TournamentConsole(Trainee.Player.Console).ShowMessage();
00164		TutorialSound(DOM[0]);
00165		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[0]);
00166		SoundIndex++;
00167	
00168		Trainee.Health = 100;
00169	}
00170	
00171	function DOMTutEvent1()
00172	{
00173		TutorialSound(DOM[1]);
00174		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[1]);
00175		SoundIndex++;
00176	}
00177	
00178	function DOMTutEvent2()
00179	{
00180		local int X, Y;
00181		X = -128;
00182		Y = -128;
00183	
00184		TutorialSound(DOM[2]);
00185		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[2]);
00186		SoundIndex++;
00187	}
00188	
00189	function DOMTutEvent3()
00190	{
00191		TutorialSound(DOM[3]);
00192		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[3]);
00193		SoundIndex++;
00194	}
00195	
00196	function DOMTutEvent4()
00197	{
00198		TutorialSound(DOM[4]);
00199		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[4]);
00200		SoundIndex++;
00201	}
00202	
00203	function DOMTutEvent5()
00204	{
00205		TutorialSound(DOM[5]);
00206		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[5]);
00207		SoundIndex++;
00208	}
00209	
00210	function DOMTutEvent6()
00211	{
00212		TutorialSound(DOM[6]);
00213		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[6]);
00214		SoundIndex++;
00215	}
00216	
00217	function DOMTutEvent7()
00218	{
00219		TutorialSound(DOM[7]);
00220		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[7]);
00221		SoundIndex++;
00222	}
00223	
00224	function DOMTutEvent8()
00225	{
00226		TutorialSound(DOM[8]);
00227		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[8]);
00228		SoundIndex++;
00229	}
00230	
00231	function DOMTutEvent9()
00232	{
00233		Trainee.SetLocation(vect(-6, 347, -84));
00234		Trainee.SetRotation(rot(62680, 15916, 0));
00235		Trainee.ViewRotation = rot(62680, 15916, 0);
00236		PlayTeleportEffect(Trainee, true, true);
00237	
00238		TutorialSound(DOM[9]);
00239		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[9]);
00240		SoundIndex++;
00241	}
00242	
00243	function DOMTutEvent10()
00244	{
00245		local ControlPoint CP;
00246		local PlayerPawn P;
00247		local vector Loc;
00248	
00249		foreach AllActors(class'ControlPoint', CP)
00250		{
00251			if (CP.Tag == 'ControlPointGamma')
00252			{
00253				CP.SetCollision(True, False, False);
00254				foreach RadiusActors(class'PlayerPawn', P, CP.CollisionRadius, CP.Location)
00255				{
00256					CP.Touch(P);
00257				}
00258			}
00259		}
00260	
00261		bPause = True;
00262		GotoState('FreeRunning1');
00263	}
00264	
00265	state FreeRunning1
00266	{
00267		function Tick(float DeltaTime)
00268		{
00269			local ControlPoint CP;
00270	
00271			Super.Tick(DeltaTime);
00272	
00273			foreach AllActors(class'ControlPoint', CP)
00274			{
00275				if (CP.Controller == Trainee)
00276				{
00277					bPause = False;
00278	
00279					TutorialSound(DOM[10]);
00280					TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[10]);
00281					SoundIndex++;
00282					
00283					GotoState('');
00284				}
00285			}
00286		}
00287	}
00288	
00289	function DOMTutEvent11()
00290	{
00291		local int X, Y;
00292		X = -128;
00293		Y = -160;
00294	
00295		TutorialSound(DOM[11]);
00296		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[11]);
00297		SoundIndex++;
00298	}
00299	
00300	function DOMTutEvent12()
00301	{
00302		local ControlPoint CP;
00303		local PlayerPawn P;
00304		local vector Loc;
00305	
00306		TutorialSound(DOM[12]);
00307		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[12]);
00308		SoundIndex++;
00309		foreach AllActors(class'ControlPoint', CP)
00310		{
00311			if (CP.Tag == 'ControlPointAlpha')
00312			{
00313				CP.SetCollision(True, False, False);
00314				foreach RadiusActors(class'PlayerPawn', P, CP.CollisionRadius, CP.Location)
00315				{
00316					CP.Touch(P);
00317				}
00318			}
00319		}
00320	
00321		bPause = True;
00322		GoToState('FreeRunning2');
00323	}
00324	
00325	state FreeRunning2
00326	{
00327		function Tick(float DeltaTime)
00328		{
00329			local ControlPoint CP;
00330			local int ControlSum;
00331	
00332			Super.Tick(DeltaTime);
00333	
00334			foreach AllActors(class'ControlPoint', CP)
00335			{
00336				if (CP.Controller == Trainee)
00337					ControlSum++;
00338				if (ControlSum == 2)
00339				{
00340					bPause = False;
00341	
00342					TutorialSound(DOM[13]);
00343					TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[13]);
00344					SoundIndex++;
00345	
00346					GoToState('');
00347				}
00348			}
00349		}
00350	}
00351	
00352	function DOMTutEvent13()
00353	{
00354		TutorialSound(DOM[14]);
00355		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[14]);
00356		SoundIndex++;
00357	}
00358	
00359	function DOMTutEvent14()
00360	{
00361		// Select the translocator.
00362		Trainee.GetWeapon(Class<Weapon>(DynamicLoadObject(TranslocatorClass, class'Class')));
00363	
00364		TutorialSound(DOM[15]);
00365		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[15]);
00366		SoundIndex++;
00367	
00368		bPause = True;
00369		GoToState('FreeRunning3');
00370	}
00371	
00372	state FreeRunning3
00373	{
00374		function Tick(float DeltaTime)
00375		{
00376			Super.Tick(DeltaTime);
00377	
00378			if ((Trainee.bFire != 0) && (Trainee.Weapon.IsA('Translocator')))
00379			{
00380				bPause = False;
00381	
00382				TutorialSound(DOM[16]);
00383				TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[16]);
00384				SoundIndex++;
00385	
00386				GoToState('');
00387			}
00388		}
00389	}
00390	
00391	function DOMTutEvent15()
00392	{
00393		bPause = True;
00394		GoToState('FreeRunning4');
00395	}
00396	
00397	state FreeRunning4
00398	{
00399		function Tick(float DeltaTime)
00400		{
00401			Super.Tick(DeltaTime);
00402	
00403			if ((Trainee.bAltFire != 0) && (Trainee.Weapon.IsA('Translocator')))
00404			{
00405				bPause = False;
00406	
00407				TutorialSound(DOM[17]);
00408				TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[17]);
00409				SoundIndex++;
00410	
00411				GotoState('');
00412			}
00413		}
00414	}
00415	
00416	function DOMTutEvent16()
00417	{
00418		TutorialSound(DOM[18]);
00419		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[18]);
00420		SoundIndex++;	
00421	}
00422	
00423	function DOMTutEvent17()
00424	{
00425		TutorialSound(DOM[19]);
00426		TournamentConsole(Trainee.Player.Console).AddMessage(TutMessage[19]);
00427		SoundIndex++;	
00428	}
00429	
00430	function DOMTutEvent18()
00431	{
00432		local ControlPoint CP;
00433		local int i;
00434	
00435		foreach AllActors(class'ControlPoint', CP)
00436		{
00437			CP.Controller = None;
00438		}
00439	
00440		for (i = 0; i < 2; i++)
00441			Teams[i].Score = 0;
00442	
00443		GoalTeamScore = 20;
00444	
00445		bRatedGame = True;
00446		RemainingBots = RatedMatchConfig.NumBots;
00447	
00448		TournamentConsole(Trainee.Player.Console).HideMessage();
00449	}
00450	
00451	function bool SuccessfulGame()
00452	{
00453		local TeamInfo BestTeam;
00454		local int i;
00455		BestTeam = Teams[0];
00456		for ( i=1; i<MaxTeams; i++ )
00457			if ( Teams[i].Score > BestTeam.Score )
00458				BestTeam = Teams[i];
00459	
00460		if (BestTeam.TeamIndex == Trainee.PlayerReplicationInfo.Team)
00461			return (BestTeam.Score >= GoalTeamScore);
00462		else
00463			return false;
00464	}
00465	
00466	function EndGame( string Reason )
00467	{
00468		Super.EndGame(Reason);
00469	
00470		if (Trainee.IsA('TournamentPlayer'))
00471			TournamentPlayer(Trainee).bAutoTaunt = bOldAutoTaunt;
00472	
00473		if (SuccessfulGame())
00474			TutorialSound(DOM[20]);
00475		else
00476			Trainee.ClientPlaySound(sound'Announcer.LostMatch', True);
00477	
00478		if (RatedGameLadderObj != None)
00479		{
00480			RatedGameLadderObj.PendingChange = 0;
00481			RatedGameLadderObj.LastMatchType = LadderTypeIndex;
00482			if (RatedGameLadderObj.DOMPosition < 1)
00483			{
00484				RatedGameLadderObj.PendingChange = LadderTypeIndex;
00485				RatedGameLadderObj.PendingRank = 1;
00486				RatedGameLadderObj.PendingPosition = 1;
00487			}
00488		}
00489		GoToState('ServerTravel');
00490	}
00491	
00492	state ServerTravel
00493	{
00494		function Timer()
00495		{
00496			local string StartMap;
00497	
00498			StartMap = "UT-Logo-Map.unr"
00499				$"?Game=Botpack.LadderTransition";
00500	
00501			Trainee.ClientTravel(StartMap, TRAVEL_Absolute, True);
00502		}
00503	
00504		function BeginState()
00505		{
00506			SetTimer(9.0, true);
00507		}
00508	}
00509	
00510	defaultproperties
00511	{
00512	     DOM(0)="TutVoiceDOM.dom00"
00513	     DOM(1)="TutVoiceDOM.dom01"
00514	     DOM(2)="TutVoiceDOM.dom02"
00515	     DOM(3)="TutVoiceDOM.dom03"
00516	     DOM(4)="TutVoiceDOM.dom04"
00517	     DOM(5)="TutVoiceDOM.dom05"
00518	     DOM(6)="TutVoiceDOM.dom06"
00519	     DOM(7)="TutVoiceDOM.dom07"
00520	     DOM(8)="TutVoiceDOM.dom08"
00521	     DOM(9)="TutVoiceDOM.dom09"
00522	     DOM(10)="TutVoiceDOM.dom10"
00523	     DOM(11)="TutVoiceDOM.dom11"
00524	     DOM(12)="TutVoiceDOM.dom12"
00525	     DOM(13)="TutVoiceDOM.dom13"
00526	     DOM(14)="TutVoiceDOM.dom14"
00527	     DOM(15)="TutVoiceDOM.dom15"
00528	     DOM(16)="TutVoiceDOM.dom16"
00529	     DOM(17)="TutVoiceDOM.dom17"
00530	     DOM(18)="TutVoiceDOM.dom18"
00531	     DOM(19)="TutVoiceDOM.dom19"
00532	     DOM(20)="TutVoiceDOM.dom20"
00533	     TutMessage(0)="Welcome to Domination combat training. This tutorial will instruct you on the basic gameplay rules of Domination. Tutorials on Deathmatch, Capture the Flag, and Assault are also available."
00534	     TutMessage(1)="Let's start by learning about the elements Domination adds to the Heads Up Display (HUD)."
00535	     TutMessage(2)="Domination enhances the basic teamplay HUD by adding control point status indicators to the left side of your screen."
00536	     TutMessage(3)="As you can see, there are two control points in this tutorial map. We'll discuss the function of control points shortly."
00537	     TutMessage(4)="Each indicator shows the name of a control point and that control point's current status."
00538	     TutMessage(5)="Every control point in a domination map has a unique name. These controls points are named Alpha and Gamma."
00539	     TutMessage(6)="The icon next to the control point name displays the status of that location. Before I explain how these icons work, let's discuss the rules of Domination."
00540	     TutMessage(7)="In Domination each team is trying to control and hold the level's control points."
00541	     TutMessage(8)="A team is given 1 point every 5 seconds for each location they control."
00542	     TutMessage(9)="This is a control point. The grey X symbol indicates that no team is in control of this location. To take control of a location, touch it. Do this now."
00543	     TutMessage(10)="Good. Your team now controls this location. Notice that the shape and color of the control point has changed to reflect your team symbol and color."
00544	     TutMessage(11)="Look at the control point status icon. Notice that the Gamma point icon has changed to indicate your team is in control. You can use these icons to quickly assess the state of a Domination game."
00545	     TutMessage(12)="Now find and control the Alpha point to secure your Domination of this map."
00546	     TutMessage(13)="Excellent, you control all of the points on this map."
00547	     TutMessage(14)="In summary, each team must locate and capture certain points in a Domination map. The more locations a team controls the faster their score increases."
00548	     TutMessage(15)="This device is called a 'Translocator.' You use it to transport from one location to another instantly. Hit the fire button to launch the translocator destination module."
00549	     TutMessage(16)="The module is now on the floor. If you hit the alt-fire button you will be teleported to the module. Run away from the module and hit the alt-fire button."
00550	     TutMessage(17)="Good now you are back at the module. If you fire the module out, you can switch to a weapon and later switch back to the translocator to activate it anytime you want."
00551	     TutMessage(18)="If you see an enemy translocator module on the ground, you can shoot it to disrupt it. Translocating to a disrupted module causes instant death."
00552	     TutMessage(19)="Its time for a test. I'm going to spawn two bots on the enemy team and one bot to assist you. The first team to gain 20 points wins. Good luck!"
00553	     TutMessage(20)="Congratulations! You have proven yourself to be a worthy Domination player. Now its time to enter the Domination Tournament Ladder."
00554	     LastEvent=19
00555	     TranslocatorClass="Botpack.Translocator"
00556	     StartUpMessage=""
00557	     SingleWaitingMessage=""
00558	     bTutorialGame=True
00559	     Difficulty=0
00560	     MapPrefix="DOM-Tutorial"
00561	     BeaconName="DOM-Tutorial"
00562	     GameName="Combat Training: DOM"
00563	     bLoggingGame=False
00564	}

End Source Code