Botpack
Class ChallengeBotInfo

source: e:\games\UnrealTournament\Botpack\Classes\ChallengeBotInfo.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Info
         |
         +--Botpack.ChallengeBotInfo
Direct Known Subclasses:None

class ChallengeBotInfo
extends Engine.Info

//============================================================================= // ChallengeBotInfo. //=============================================================================
Variables
 float AdjustedDifficulty
 float Alertness[32]
 float BotAccuracy[32]
 string BotClasses[32]
 String BotFaces[32]
 byte BotJumpy[32]
 string BotNames[32]
 float BotSkills[32]
 string BotSkins[32]
 int BotTeams[32]
 float Camping[32]
 float CombatStyle[32]
 string DesiredName
 byte Difficulty
 string FavoriteWeapon[32]
 AvailableDescriptions[32], NextBotClass
 int NumClasses
 PlayerKills, PlayerDeaths
 string Skills[8]
 float StrafingAbility[32]
 string VoiceType[32]
 bool bAdjustSkill
 bool bRandomOrder


Function Summary
 void AdjustSkill(Bot B, bool bWinner)
 void CHIndividualize(Bot NewBot, int n, int NumBots)
 int ChooseBotInfo()
 String GetAvailableClasses(int n)
 String GetBotClassName(int n)
 String GetBotFace(int n)
 int GetBotIndex(string BotName)
 String GetBotName(int n)
 string GetBotSkin(int num)
 int GetBotTeam(int num)
 void PostBeginPlay()
 void PreBeginPlay()
 void SetBotClass(String ClassName, int n)
 void SetBotFace(string NewFace, int n)
 void SetBotName(string NewName, int n)
 void SetBotSkin(string NewSkin, int n)
 void SetBotTeam(int NewTeam, int n)



Source Code


00001	//=============================================================================
00002	// ChallengeBotInfo.
00003	//=============================================================================
00004	class ChallengeBotInfo extends Info
00005		config(User);
00006	
00007	var() config string VoiceType[32];
00008	var() config String BotFaces[32];
00009	var() config bool	bAdjustSkill;
00010	var() config bool	bRandomOrder;
00011	var   config byte	Difficulty;
00012	
00013	var() config string BotNames[32];
00014	var() config int BotTeams[32];
00015	var() config float BotSkills[32];
00016	var() config float BotAccuracy[32];
00017	var() config float CombatStyle[32]; 
00018	var() config float Alertness[32];
00019	var() config float Camping[32];
00020	var() config float StrafingAbility[32];
00021	var() config string FavoriteWeapon[32];
00022	var	  byte ConfigUsed[32];
00023	var() config string BotClasses[32];
00024	var() config string BotSkins[32];
00025	var() config byte BotJumpy[32];
00026	var string AvailableClasses[32], AvailableDescriptions[32], NextBotClass;
00027	var int NumClasses;
00028	var localized string Skills[8];
00029	var string DesiredName;
00030	
00031	var int PlayerKills, PlayerDeaths;
00032	var float AdjustedDifficulty;
00033	
00034	function PreBeginPlay()
00035	{
00036		//DON'T Call parent prebeginplay
00037	}
00038	
00039	function PostBeginPlay()
00040	{
00041		local String NextBotClass, NextBotDesc;
00042	
00043		Super.PostBeginPlay();
00044	
00045		NumClasses = 0;
00046		GetNextIntDesc("Bot", 0, NextBotClass, NextBotDesc); 
00047		while ( (NextBotClass != "") && (NumClasses < 32) )
00048		{
00049			AvailableClasses[NumClasses] = NextBotClass;
00050			AvailableDescriptions[NumClasses] = NextBotDesc;
00051			NumClasses++;
00052			GetNextIntDesc("Bot", NumClasses, NextBotClass, NextBotDesc); 
00053		}
00054	}
00055	
00056	function AdjustSkill(Bot B, bool bWinner)
00057	{
00058		local float BotSkill;
00059	
00060		BotSkill = B.Skill;
00061		if ( !b.bNovice )
00062			BotSkill += 4;
00063	
00064		if ( bWinner )
00065		{
00066			PlayerKills += 1;
00067			AdjustedDifficulty = FMax(0, AdjustedDifficulty - 2/Min(PlayerKills, 10));
00068			if ( BotSkill > AdjustedDifficulty )
00069				B.Skill = AdjustedDifficulty;
00070			if ( B.Skill < 4 )
00071			{
00072				B.bNovice = true;
00073				if ( B.Skill > 3 )
00074				{
00075					B.Skill = 3;
00076					B.bThreePlus = true;
00077				}
00078			}
00079			else
00080			{
00081				B.Skill -= 4;
00082				B.bNovice = false;
00083			}
00084		}
00085		else
00086		{
00087			PlayerDeaths += 1;
00088			AdjustedDifficulty += FMin(7,2/Min(PlayerDeaths, 10));
00089			if ( BotSkill < AdjustedDifficulty )
00090				B.Skill = AdjustedDifficulty;
00091			if ( B.Skill < 4 )
00092			{
00093				B.bNovice = true;
00094				if ( B.Skill > 3 )
00095				{
00096					B.Skill = 3;
00097					B.bThreePlus = true;
00098				}
00099			}
00100			else
00101			{
00102				B.Skill -= 4;
00103				B.bNovice = false;
00104			}
00105		}
00106		if ( abs(AdjustedDifficulty - Difficulty) >= 1 )
00107		{
00108			Difficulty = AdjustedDifficulty;
00109			SaveConfig();
00110		}
00111	}
00112	
00113	function SetBotClass(String ClassName, int n)
00114	{
00115		BotClasses[n] = ClassName;
00116	}
00117	
00118	function SetBotName( coerce string NewName, int n )
00119	{
00120		BotNames[n] = NewName;
00121	}
00122	
00123	function String GetBotName(int n)
00124	{
00125		return BotNames[n];
00126	}
00127	
00128	function int GetBotTeam(int num)
00129	{
00130		return BotTeams[Num];
00131	}
00132	
00133	function SetBotTeam(int NewTeam, int n)
00134	{
00135		BotTeams[n] = NewTeam;
00136	}
00137	
00138	function SetBotFace(coerce string NewFace, int n)
00139	{
00140		BotFaces[n] = NewFace;
00141	}
00142	
00143	function String GetBotFace(int n)
00144	{
00145		return BotFaces[n];
00146	}
00147	
00148	function CHIndividualize(bot NewBot, int n, int NumBots)
00149	{
00150		n = Clamp(n,0,31);
00151	
00152		// Set bot's skin
00153		NewBot.Static.SetMultiSkin(NewBot, BotSkins[n], BotFaces[n], BotTeams[n]);
00154	
00155		// Set bot's name.
00156		if ( (BotNames[n] == "") || (ConfigUsed[n] == 1) )
00157			BotNames[n] = "Bot";
00158	
00159		Level.Game.ChangeName( NewBot, BotNames[n], false );
00160		if ( BotNames[n] != NewBot.PlayerReplicationInfo.PlayerName )
00161			Level.Game.ChangeName( NewBot, ("Bot"$NumBots), false);
00162	
00163		ConfigUsed[n] = 1;
00164	
00165		// adjust bot skill
00166		NewBot.InitializeSkill(Difficulty + BotSkills[n]);
00167	
00168		if ( (FavoriteWeapon[n] != "") && (FavoriteWeapon[n] != "None") )
00169			NewBot.FavoriteWeapon = class<Weapon>(DynamicLoadObject(FavoriteWeapon[n],class'Class'));
00170		NewBot.Accuracy = BotAccuracy[n];
00171		NewBot.CombatStyle = NewBot.Default.CombatStyle + 0.7 * CombatStyle[n];
00172		NewBot.BaseAggressiveness = 0.5 * (NewBot.Default.Aggressiveness + NewBot.CombatStyle);
00173		NewBot.BaseAlertness = Alertness[n];
00174		NewBot.CampingRate = Camping[n];
00175		NewBot.bJumpy = ( BotJumpy[n] != 0 );
00176		NewBot.StrafingAbility = StrafingAbility[n];
00177	
00178		if ( VoiceType[n] != "" && VoiceType[n] != "None" )
00179			NewBot.PlayerReplicationInfo.VoiceType = class<VoicePack>(DynamicLoadObject(VoiceType[n], class'Class'));
00180		
00181		if(NewBot.PlayerReplicationInfo.VoiceType == None)
00182			NewBot.PlayerReplicationInfo.VoiceType = class<VoicePack>(DynamicLoadObject(NewBot.VoiceType, class'Class'));
00183	}
00184	
00185	function String GetAvailableClasses(int n)
00186	{
00187		return AvailableClasses[n];
00188	}
00189	
00190	function int ChooseBotInfo()
00191	{
00192		local int n, start;
00193	
00194		if ( DesiredName != "" )
00195		{
00196			for ( n=0; n<32; n++ )
00197				if ( BotNames[n] ~= DesiredName )
00198				{
00199					DesiredName = "";
00200					return n;
00201				}
00202			DesiredName = "";
00203		}
00204	
00205		if ( bRandomOrder )
00206			n = Rand(32);
00207		else 
00208			n = 0;
00209	
00210		start = n;
00211		while ( (n < 32) && (ConfigUsed[n] == 1) )
00212			n++;
00213	
00214		if ( (n == 32) && bRandomOrder )
00215		{
00216			n = 0;
00217			while ( (n < start) && (ConfigUsed[n] == 1) )
00218				n++;
00219		}
00220	
00221		if ( n > 31 )
00222			n = 31;
00223	
00224		return n;
00225	}
00226	
00227	function class<bot> CHGetBotClass(int n)
00228	{
00229		return class<bot>( DynamicLoadObject(GetBotClassName(n), class'Class') );
00230	}
00231	
00232	function string GetBotSkin( int num )
00233	{
00234		return BotSkins[Num];
00235	}
00236	
00237	function SetBotSkin( coerce string NewSkin, int n )
00238	{
00239		BotSkins[n] = NewSkin;
00240	}
00241	
00242	function String GetBotClassName(int n)
00243	{
00244		if ( (n < 0) || (n > 31) )
00245			return AvailableClasses[Rand(NumClasses)];
00246	
00247		if ( BotClasses[n] == "" )
00248			BotClasses[n] = AvailableClasses[Rand(NumClasses)];
00249	
00250		return BotClasses[n];
00251	}
00252	
00253	function int GetBotIndex( coerce string BotName )
00254	{
00255		local int i;
00256		local bool found;
00257	
00258		found = false;
00259		for (i=0; i<ArrayCount(BotNames)-1; i++)
00260			if (BotNames[i] == BotName)
00261			{
00262				found = true;
00263				break;
00264			}
00265	
00266		if (!found)
00267			i = -1;
00268	
00269		return i;
00270	}
00271	
00272	defaultproperties
00273	{
00274	     BotFaces(0)="CommandoSkins.Blake"
00275	     BotFaces(1)="SGirlSkins.Aryss"
00276	     BotFaces(2)="SoldierSkins.Malcom"
00277	     BotFaces(3)="CommandoSkins.Luthor"
00278	     BotFaces(4)="FCommandoSkins.Cryss"
00279	     BotFaces(5)="FCommandoSkins.Visse"
00280	     BotFaces(6)="SoldierSkins.Kregore"
00281	     BotFaces(7)="SGirlSkins.Cilia"
00282	     BotFaces(8)="CommandoSkins.Kragoth"
00283	     BotFaces(9)="FCommandoSkins.Tanya"
00284	     BotFaces(10)="SoldierSkins.Johnson"
00285	     BotFaces(11)="CommandoSkins.Boris"
00286	     BotFaces(12)="SGirlSkins.Vixen"
00287	     BotFaces(13)="SGirlSkins.Sara"
00288	     BotFaces(14)="SoldierSkins.Othello"
00289	     BotFaces(15)="FCommandoSkins.Kyla"
00290	     BotFaces(16)="CommandoSkins.Gorn"
00291	     BotFaces(17)="SGirlSkins.Annaka"
00292	     BotFaces(18)="SoldierSkins.Riker"
00293	     BotFaces(19)="FCommandoSkins.Malise"
00294	     BotFaces(20)="CommandoSkins.Ramirez"
00295	     BotFaces(21)="FCommandoSkins.Freylis"
00296	     BotFaces(22)="SoldierSkins.Arkon"
00297	     BotFaces(23)="SGirlSkins.Sarena"
00298	     BotFaces(24)="CommandoSkins.Grail"
00299	     BotFaces(25)="FCommandoSkins.Mariana"
00300	     BotFaces(26)="SoldierSkins.Rankin"
00301	     BotFaces(27)="SGirlSkins.Isis"
00302	     BotFaces(28)="CommandoSkins.Graves"
00303	     BotFaces(29)="SGirlSkins.Lauren"
00304	     BotFaces(30)="SoldierSkins.Malcom"
00305	     BotFaces(31)="FCommandoSkins.Jayce"
00306	     bAdjustSkill=True
00307	     bRandomOrder=True
00308	     BotNames(0)="Archon"
00309	     BotNames(1)="Aryss"
00310	     BotNames(2)="Alarik"
00311	     BotNames(3)="Dessloch"
00312	     BotNames(4)="Cryss"
00313	     BotNames(5)="Nikita"
00314	     BotNames(6)="Drimacus"
00315	     BotNames(7)="Rhea"
00316	     BotNames(8)="Raynor"
00317	     BotNames(9)="Kira"
00318	     BotNames(10)="Karag"
00319	     BotNames(11)="Zenith"
00320	     BotNames(12)="Cali"
00321	     BotNames(13)="Alys"
00322	     BotNames(14)="Kosak"
00323	     BotNames(15)="Illana"
00324	     BotNames(16)="Barak"
00325	     BotNames(17)="Kara"
00326	     BotNames(18)="Tamerlane"
00327	     BotNames(19)="Arachne"
00328	     BotNames(20)="Liche"
00329	     BotNames(21)="Jared"
00330	     BotNames(22)="Ichthys"
00331	     BotNames(23)="Tamara"
00332	     BotNames(24)="Loque"
00333	     BotNames(25)="Athena"
00334	     BotNames(26)="Cilia"
00335	     BotNames(27)="Sarena"
00336	     BotNames(28)="Malakai"
00337	     BotNames(29)="Visse"
00338	     BotNames(30)="Necroth"
00339	     BotNames(31)="Kragoth"
00340	     BotTeams(0)=255
00341	     BotTeams(2)=255
00342	     BotTeams(3)=1
00343	     BotTeams(4)=255
00344	     BotTeams(5)=2
00345	     BotTeams(6)=255
00346	     BotTeams(7)=3
00347	     BotTeams(8)=255
00348	     BotTeams(10)=255
00349	     BotTeams(11)=1
00350	     BotTeams(12)=255
00351	     BotTeams(13)=2
00352	     BotTeams(14)=255
00353	     BotTeams(15)=3
00354	     BotTeams(16)=255
00355	     BotTeams(18)=255
00356	     BotTeams(19)=1
00357	     BotTeams(20)=255
00358	     BotTeams(21)=2
00359	     BotTeams(22)=255
00360	     BotTeams(23)=3
00361	     BotTeams(24)=255
00362	     BotTeams(26)=255
00363	     BotTeams(27)=1
00364	     BotTeams(28)=255
00365	     BotTeams(29)=2
00366	     BotTeams(30)=255
00367	     BotTeams(31)=3
00368	     BotAccuracy(17)=0.200000
00369	     BotAccuracy(18)=0.900000
00370	     BotAccuracy(19)=0.600000
00371	     BotAccuracy(20)=0.500000
00372	     BotAccuracy(24)=1.000000
00373	     BotAccuracy(27)=0.500000
00374	     BotAccuracy(28)=0.500000
00375	     BotAccuracy(29)=0.600000
00376	     CombatStyle(16)=0.500000
00377	     CombatStyle(18)=-0.500000
00378	     CombatStyle(19)=-0.500000
00379	     CombatStyle(20)=-1.000000
00380	     CombatStyle(21)=-0.500000
00381	     CombatStyle(22)=0.500000
00382	     CombatStyle(23)=1.000000
00383	     CombatStyle(26)=0.500000
00384	     CombatStyle(30)=0.500000
00385	     Alertness(18)=-0.300000
00386	     Alertness(20)=0.300000
00387	     Alertness(22)=0.300000
00388	     Alertness(24)=0.300000
00389	     Alertness(29)=0.400000
00390	     Camping(18)=1.000000
00391	     Camping(28)=0.500000
00392	     StrafingAbility(17)=0.500000
00393	     StrafingAbility(20)=0.500000
00394	     StrafingAbility(21)=1.000000
00395	     StrafingAbility(22)=0.500000
00396	     StrafingAbility(23)=0.500000
00397	     StrafingAbility(24)=0.500000
00398	     StrafingAbility(25)=0.500000
00399	     StrafingAbility(26)=0.500000
00400	     StrafingAbility(29)=1.000000
00401	     FavoriteWeapon(16)="Botpack.UT_FlakCannon"
00402	     FavoriteWeapon(17)="Botpack.UT_Eightball"
00403	     FavoriteWeapon(18)="Botpack.SniperRifle"
00404	     FavoriteWeapon(19)="Botpack.SniperRifle"
00405	     FavoriteWeapon(22)="Botpack.PulseGun"
00406	     FavoriteWeapon(25)="Botpack.Minigun2"
00407	     FavoriteWeapon(27)="Botpack.ShockRifle"
00408	     FavoriteWeapon(28)="Botpack.ShockRifle"
00409	     BotClasses(0)="BotPack.TMale1Bot"
00410	     BotClasses(1)="BotPack.TFemale2Bot"
00411	     BotClasses(2)="BotPack.TMale2Bot"
00412	     BotClasses(3)="BotPack.TMale1Bot"
00413	     BotClasses(4)="BotPack.TFemale1Bot"
00414	     BotClasses(5)="BotPack.TFemale1Bot"
00415	     BotClasses(6)="BotPack.TMale2Bot"
00416	     BotClasses(7)="BotPack.TFemale2Bot"
00417	     BotClasses(8)="BotPack.TMale1Bot"
00418	     BotClasses(9)="BotPack.TFemale1Bot"
00419	     BotClasses(10)="BotPack.TMale2Bot"
00420	     BotClasses(11)="BotPack.TMale1Bot"
00421	     BotClasses(12)="BotPack.TFemale2Bot"
00422	     BotClasses(13)="BotPack.TFemale2Bot"
00423	     BotClasses(14)="BotPack.TMale2Bot"
00424	     BotClasses(15)="BotPack.TFemale1Bot"
00425	     BotClasses(16)="BotPack.TMale1Bot"
00426	     BotClasses(17)="BotPack.TFemale2Bot"
00427	     BotClasses(18)="BotPack.TMale2Bot"
00428	     BotClasses(19)="BotPack.TFemale1Bot"
00429	     BotClasses(20)="BotPack.TMale1Bot"
00430	     BotClasses(21)="BotPack.TFemale1Bot"
00431	     BotClasses(22)="BotPack.TMale2Bot"
00432	     BotClasses(23)="BotPack.TFemale2Bot"
00433	     BotClasses(24)="BotPack.TMale1Bot"
00434	     BotClasses(25)="BotPack.TFemale1Bot"
00435	     BotClasses(26)="BotPack.TMale2Bot"
00436	     BotClasses(27)="BotPack.TFemale2Bot"
00437	     BotClasses(28)="BotPack.TMale1Bot"
00438	     BotClasses(29)="BotPack.TFemale2Bot"
00439	     BotClasses(30)="BotPack.TMale2Bot"
00440	     BotClasses(31)="BotPack.TFemale1Bot"
00441	     BotSkins(0)="CommandoSkins.cmdo"
00442	     BotSkins(1)="SGirlSkins.fbth"
00443	     BotSkins(2)="SoldierSkins.blkt"
00444	     BotSkins(3)="CommandoSkins.daco"
00445	     BotSkins(4)="FCommandoSkins.goth"
00446	     BotSkins(5)="FCommandoSkins.goth"
00447	     BotSkins(6)="SoldierSkins.RawS"
00448	     BotSkins(7)="SGirlSkins.Venm"
00449	     BotSkins(8)="CommandoSkins.goth"
00450	     BotSkins(9)="FCommandoSkins.daco"
00451	     BotSkins(10)="SoldierSkins.sldr"
00452	     BotSkins(11)="CommandoSkins.daco"
00453	     BotSkins(12)="SGirlSkins.Garf"
00454	     BotSkins(13)="SGirlSkins.army"
00455	     BotSkins(14)="SoldierSkins.blkt"
00456	     BotSkins(15)="FCommandoSkins.daco"
00457	     BotSkins(16)="CommandoSkins.cmdo"
00458	     BotSkins(17)="SGirlSkins.fbth"
00459	     BotSkins(18)="SoldierSkins.blkt"
00460	     BotSkins(19)="FCommandoSkins.goth"
00461	     BotSkins(20)="CommandoSkins.daco"
00462	     BotSkins(21)="FCommandoSkins.goth"
00463	     BotSkins(22)="SoldierSkins.RawS"
00464	     BotSkins(23)="SGirlSkins.Venm"
00465	     BotSkins(24)="CommandoSkins.goth"
00466	     BotSkins(25)="FCommandoSkins.daco"
00467	     BotSkins(26)="SoldierSkins.sldr"
00468	     BotSkins(27)="SGirlSkins.Garf"
00469	     BotSkins(28)="CommandoSkins.daco"
00470	     BotSkins(29)="SGirlSkins.army"
00471	     BotSkins(30)="SoldierSkins.blkt"
00472	     BotSkins(31)="FCommandoSkins.daco"
00473	     BotJumpy(30)=1
00474	     BotJumpy(31)=1
00475	     Skills(0)="Novice"
00476	     Skills(1)="Average"
00477	     Skills(2)="Experienced"
00478	     Skills(3)="Skilled"
00479	     Skills(4)="Adept"
00480	     Skills(5)="Masterful"
00481	     Skills(6)="Inhuman"
00482	     Skills(7)="Godlike"
00483	}

End Source Code