00001 class UTIndivBotSetupClient extends UMenuBotSetupBase;
00002
00003 var ChallengeBotInfo BotInfo;
00004
00005 // VoicePack
00006 var UWindowHSliderControl SkillSlider;
00007 var localized string SkillText;
00008 var localized string SkillHelp;
00009
00010 var UWindowComboControl VoicePackCombo;
00011 var localized string VoicePackText;
00012 var localized string VoicePackHelp;
00013
00014 var UWindowComboControl FavoriteWeaponCombo;
00015 var localized string FavoriteWeaponText;
00016 var localized string FavoriteWeaponHelp;
00017 var localized string NoFavoriteWeapon;
00018
00019 var UWindowHSliderControl AccuracySlider;
00020 var localized string AccuracyText;
00021 var localized string AccuracyHelp;
00022
00023 var UWindowHSliderControl AlertnessSlider;
00024 var localized string AlertnessText;
00025 var localized string AlertnessHelp;
00026
00027 var UWindowHSliderControl CampingSlider;
00028 var localized string CampingText;
00029 var localized string CampingHelp;
00030
00031 var UWindowHSliderControl StrafingAbilitySlider;
00032 var localized string StrafingAbilityText;
00033 var localized string StrafingAbilityHelp;
00034
00035 var UWindowComboControl CombatStyleCombo;
00036 var localized string CombatStyleText;
00037 var localized string CombatStyleHelp;
00038 var localized float CombatStyleValues[10];
00039 var localized string CombatStyleNames[10];
00040
00041 var UWindowCheckbox JumpyCheck;
00042 var localized string JumpyText;
00043 var localized string JumpyHelp;
00044
00045 var bool ClassChanging;
00046
00047 function Created()
00048 {
00049 local int ControlWidth, ControlLeft, ControlRight;
00050 local int CenterWidth, CenterPos;
00051 local int i;
00052
00053 ControlWidth = WinWidth/3;
00054 ControlLeft = (WinWidth/2 - ControlWidth)/2;
00055 ControlRight = WinWidth/2 + ControlLeft;
00056
00057 CenterWidth = (WinWidth/4)*3;
00058 CenterPos = (WinWidth - CenterWidth)/2;
00059
00060 Super.Created();
00061
00062 ControlOffset += 25;
00063 SkillSlider = UWindowHSliderControl(CreateControl(class'UWindowHSliderControl', CenterPos, ControlOffset, CenterWidth, 1));
00064 SkillSlider.bNoSlidingNotify = True;
00065 SkillSlider.SetRange(0, 6, 1);
00066 SkillSlider.SetText(SkillText);
00067 SkillSlider.SetHelpText(SkillHelp);
00068 SkillSlider.SetFont(F_Normal);
00069
00070 ControlOffset += 25;
00071 VoicePackCombo = UWindowComboControl(CreateControl(class'UWindowComboControl', CenterPos, ControlOffset, CenterWidth, 1));
00072 VoicePackCombo.SetText(VoicePackText);
00073 VoicePackCombo.SetHelpText(VoicePackHelp);
00074 VoicePackCombo.SetFont(F_Normal);
00075 VoicePackCombo.SetEditable(False);
00076
00077 ControlOffset += 25;
00078 FavoriteWeaponCombo = UWindowComboControl(CreateControl(class'UWindowComboControl', CenterPos, ControlOffset, CenterWidth, 1));
00079 FavoriteWeaponCombo.SetText(FavoriteWeaponText);
00080 FavoriteWeaponCombo.SetHelpText(FavoriteWeaponHelp);
00081 FavoriteWeaponCombo.SetFont(F_Normal);
00082 FavoriteWeaponCombo.SetEditable(False);
00083 LoadWeapons();
00084
00085 ControlOffset += 25;
00086 AccuracySlider = UWindowHSliderControl(CreateControl(class'UWindowHSliderControl', CenterPos, ControlOffset, CenterWidth, 1));
00087 AccuracySlider.bNoSlidingNotify = True;
00088 AccuracySlider.SetRange(0, 200, 5);
00089 AccuracySlider.SetText(AccuracyText);
00090 AccuracySlider.SetHelpText(AccuracyHelp);
00091 AccuracySlider.SetFont(F_Normal);
00092
00093 ControlOffset += 25;
00094 AlertnessSlider = UWindowHSliderControl(CreateControl(class'UWindowHSliderControl', CenterPos, ControlOffset, CenterWidth, 1));
00095 AlertnessSlider.bNoSlidingNotify = True;
00096 AlertnessSlider.SetRange(0, 200, 5);
00097 AlertnessSlider.SetText(AlertnessText);
00098 AlertnessSlider.SetHelpText(AlertnessHelp);
00099 AlertnessSlider.SetFont(F_Normal);
00100
00101 ControlOffset += 25;
00102 CampingSlider = UWindowHSliderControl(CreateControl(class'UWindowHSliderControl', CenterPos, ControlOffset, CenterWidth, 1));
00103 CampingSlider.bNoSlidingNotify = True;
00104 CampingSlider.SetRange(0, 100, 10);
00105 CampingSlider.SetText(CampingText);
00106 CampingSlider.SetHelpText(CampingHelp);
00107 CampingSlider.SetFont(F_Normal);
00108
00109 ControlOffset += 25;
00110 StrafingAbilitySlider = UWindowHSliderControl(CreateControl(class'UWindowHSliderControl', CenterPos, ControlOffset, CenterWidth, 1));
00111 StrafingAbilitySlider.bNoSlidingNotify = True;
00112 StrafingAbilitySlider.SetRange(0, 8, 1);
00113 StrafingAbilitySlider.SetText(StrafingAbilityText);
00114 StrafingAbilitySlider.SetHelpText(StrafingAbilityHelp);
00115 StrafingAbilitySlider.SetFont(F_Normal);
00116
00117 ControlOffset += 25;
00118 CombatStyleCombo = UWindowComboControl(CreateControl(class'UWindowComboControl', CenterPos, ControlOffset, CenterWidth, 1));
00119 CombatStyleCombo.SetText(CombatStyleText);
00120 CombatStyleCombo.SetHelpText(CombatStyleHelp);
00121 CombatStyleCombo.SetFont(F_Normal);
00122 CombatStyleCombo.SetEditable(False);
00123 for(i=0;i<10 && CombatStyleNames[i] != "";i++)
00124 CombatStyleCombo.AddItem(CombatStyleNames[i], string(CombatStyleValues[i]));
00125
00126 ControlOffset += 25;
00127 JumpyCheck = UWindowCheckbox(CreateControl(class'UWindowCheckbox', CenterPos, ControlOffset, CenterWidth, 1));
00128 JumpyCheck.SetText(JumpyText);
00129 JumpyCheck.SetHelpText(JumpyHelp);
00130 JumpyCheck.SetFont(F_Normal);
00131 JumpyCheck.Align = TA_Left;
00132 }
00133
00134 function LoadBots()
00135 {
00136 local class<ChallengeBotInfo> C;
00137 local int i;
00138 local int NumBots;
00139
00140 C = class<ChallengeBotInfo>(DynamicLoadObject("Botpack.ChallengeBotInfo", class'Class'));
00141 BotInfo = GetEntryLevel().Spawn(C);
00142
00143 if(UMenuBotConfigBase(OwnerWindow).RandomCheck.bChecked)
00144 NumBots = 32;
00145 else
00146 NumBots = Int(UMenuBotConfigBase(OwnerWindow).NumBotsEdit.GetValue());
00147
00148
00149 // Add the bots into the combo
00150 for(i=0;i<NumBots;i++)
00151 BotCombo.AddItem(BotWord@string(i+1), String(i));
00152 }
00153
00154 function ResetBots()
00155 {
00156 local class<ChallengeBotInfo> C;
00157 C = BotInfo.Class;
00158 BotInfo.Destroy();
00159 class'ChallengeBotInfo'.static.ResetConfig();
00160 BotInfo = GetEntryLevel().Spawn(C);
00161
00162 Initialized = False;
00163 ConfigureBot = 0;
00164 BotCombo.SetSelectedIndex(0);
00165 LoadCurrent();
00166 UseSelected();
00167 Initialized = True;
00168 }
00169
00170 function LoadWeapons()
00171 {
00172 local int NumWeaponClasses;
00173 local string NextWeapon, NextDesc;
00174 local string WeaponBaseClass;
00175
00176 WeaponBaseClass = "TournamentWeapon";
00177
00178 FavoriteWeaponCombo.AddItem(NoFavoriteWeapon, "None");
00179
00180 GetPlayerOwner().GetNextIntDesc(WeaponBaseClass, 0, NextWeapon, NextDesc);
00181 while( (NextWeapon != "") && (NumWeaponClasses < 64) )
00182 {
00183 FavoriteWeaponCombo.AddItem(NextDesc, NextWeapon);
00184 NumWeaponClasses++;
00185 GetPlayerOwner().GetNextIntDesc(WeaponBaseClass, NumWeaponClasses, NextWeapon, NextDesc);
00186 }
00187 FavoriteWeaponCombo.Sort();
00188 }
00189
00190 function LoadClasses()
00191 {
00192 local int i;
00193 local int SortWeight;
00194
00195 for(i=0;i<BotInfo.NumClasses;i++)
00196 {
00197 if(!(BotInfo.AvailableClasses[i] ~= "Botpack.TBossBot") || class'Ladder'.Default.HasBeatenGame)
00198 ClassCombo.AddItem(BotInfo.AvailableDescriptions[i], BotInfo.AvailableClasses[i], SortWeight);
00199 }
00200 }
00201
00202 function Notify(UWindowDialogControl C, byte E)
00203 {
00204 Super.Notify(C, E);
00205
00206 switch(E)
00207 {
00208 case DE_Change:
00209 switch(C)
00210 {
00211 case SkillSlider:
00212 SkillChanged();
00213 break;
00214 case FavoriteWeaponCombo:
00215 FavouriteWeaponChanged();
00216 break;
00217 case CampingSlider:
00218 CampingChanged();
00219 break;
00220 case StrafingAbilitySlider:
00221 StrafingAbilityChanged();
00222 break;
00223 case AlertnessSlider:
00224 AlertnessChanged();
00225 break;
00226 case AccuracySlider:
00227 AccuracyChanged();
00228 break;
00229 case CombatStyleCombo:
00230 CombatStyleChanged();
00231 break;
00232 case JumpyCheck:
00233 JumpyChanged();
00234 break;
00235 case VoicePackCombo:
00236 VoiceChanged();
00237 break;
00238 }
00239 }
00240 }
00241
00242 function Close(optional bool bByParent)
00243 {
00244 Super.Close(bByParent);
00245 BotInfo.SaveConfig();
00246 BotInfo.Destroy();
00247 BotInfo = None;
00248 }
00249
00250 function ClassChanged()
00251 {
00252 Super.ClassChanged();
00253
00254 if(Initialized)
00255 {
00256 ClassChanging = True;
00257 IterateVoices();
00258 VoicePackCombo.SetSelectedIndex(Max(VoicePackCombo.FindItemIndex2(class<Bot>(NewPlayerClass).default.VoiceType, True), 0));
00259 ClassChanging = False;
00260 }
00261 }
00262
00263 function IterateVoices()
00264 {
00265 local int NumVoices;
00266 local string NextVoice, NextDesc;
00267 local string VoicepackMetaClass;
00268 local bool OldInitialized;
00269
00270 OldInitialized = Initialized;
00271 Initialized = False;
00272 VoicePackCombo.Clear();
00273 Initialized = OldInitialized;
00274
00275 if(ClassIsChildOf(NewPlayerClass, class'Bot'))
00276 VoicePackMetaClass = class<Bot>(NewPlayerClass).default.VoicePackMetaClass;
00277 else
00278 VoicePackMetaClass = "Botpack.ChallengeVoicePack";
00279
00280 // Load the base class into memory to prevent GetNextIntDesc crashing as the class isn't loadded.
00281 DynamicLoadObject(VoicePackMetaClass, class'Class');
00282
00283 GetPlayerOwner().GetNextIntDesc(VoicePackMetaClass, 0, NextVoice, NextDesc);
00284 while( (NextVoice != "") && (NumVoices < 64) )
00285 {
00286 if(!(NextVoice ~= "Botpack.VoiceBoss") || class'Ladder'.Default.HasBeatenGame)
00287 {
00288 if(NextVoice ~= "Botpack.VoiceBoss")
00289 VoicePackCombo.AddItem(NextDesc, "Botpack.VoiceBotBoss", 0);
00290 else
00291 VoicePackCombo.AddItem(NextDesc, NextVoice, 0);
00292 }
00293
00294 NumVoices++;
00295 GetPlayerOwner().GetNextIntDesc(VoicePackMetaClass, NumVoices, NextVoice, NextDesc);
00296 }
00297
00298 VoicePackCombo.Sort();
00299 }
00300
00301 function LoadCurrent()
00302 {
00303 local int i;
00304 local string Voice;
00305
00306 NameEdit.SetValue(BotInfo.GetBotName(ConfigureBot));
00307 i = TeamCombo.FindItemIndex2(string(BotInfo.BotTeams[ConfigureBot]));
00308 if(i == -1)
00309 i = 255;
00310 TeamCombo.SetSelectedIndex(i);
00311 ClassCombo.SetSelectedIndex(Max(ClassCombo.FindItemIndex2(BotInfo.GetBotClassName(ConfigureBot), True), 0));
00312 SkinCombo.SetSelectedIndex(Max(SkinCombo.FindItemIndex2(BotInfo.GetBotSkin(ConfigureBot), True), 0));
00313 FaceCombo.SetSelectedIndex(Max(FaceCombo.FindItemIndex2(BotInfo.BotFaces[ConfigureBot], True), 0));
00314 FavoriteWeaponCombo.SetSelectedIndex(Max(FavoriteWeaponCombo.FindItemIndex2(BotInfo.FavoriteWeapon[ConfigureBot], True), 0));
00315 AccuracySlider.SetValue(100*(BotInfo.BotAccuracy[ConfigureBot]+1));
00316 AlertnessSlider.SetValue(100*(BotInfo.Alertness[ConfigureBot]+1));
00317 CampingSlider.SetValue(100*(BotInfo.Camping[ConfigureBot]));
00318 StrafingAbilitySlider.SetValue(4*(BotInfo.StrafingAbility[ConfigureBot]+1));
00319 CombatStyleCombo.SetSelectedIndex(Max(CombatStyleCombo.FindItemIndex2(string(BotInfo.CombatStyle[ConfigureBot]), False), 0));
00320 JumpyCheck.bChecked = BotInfo.BotJumpy[ConfigureBot] != 0;
00321 SkillSlider.SetValue(BotInfo.BotSkills[ConfigureBot] + 3);
00322
00323 ClassChanging = True;
00324 IterateVoices();
00325 i= VoicePackCombo.FindItemIndex2(BotInfo.VoiceType[ConfigureBot], True);
00326 if(i != -1)
00327 VoicePackCombo.SetSelectedIndex(i);
00328 else
00329 VoicePackCombo.SetSelectedIndex(Max(VoicePackCombo.FindItemIndex2(class<Bot>(NewPlayerClass).default.VoiceType, True), 0));
00330 ClassChanging = False;
00331 }
00332
00333 function JumpyChanged()
00334 {
00335 if (Initialized)
00336 {
00337 if(JumpyCheck.bChecked)
00338 BotInfo.BotJumpy[ConfigureBot] = 1;
00339 else
00340 BotInfo.BotJumpy[ConfigureBot] = 0;
00341 }
00342 }
00343
00344 simulated function VoiceChanged()
00345 {
00346 local class<ChallengeVoicePack> VoicePackClass;
00347 local ChallengeVoicePack V;
00348
00349 if(Initialized)
00350 {
00351 if(!ClassChanging)
00352 {
00353 VoicePackClass = class<ChallengeVoicePack>(DynamicLoadObject(VoicePackCombo.GetValue2(), class'Class'));
00354 V = GetPlayerOwner().spawn(VoicePackClass,GetPlayerOwner(),,GetPlayerOwner().Location);
00355 V.ClientInitialize(GetPlayerOwner().PlayerReplicationInfo,GetPlayerOwner().PlayerReplicationInfo,'ACK', Rand(VoicePackClass.Default.NumAcks));
00356 }
00357 BotInfo.VoiceType[ConfigureBot] = VoicePackCombo.GetValue2();
00358 }
00359 }
00360
00361 function NameChanged()
00362 {
00363 if (Initialized)
00364 BotInfo.SetBotName(NameEdit.GetValue(), ConfigureBot);
00365 }
00366
00367 function FavouriteWeaponChanged()
00368 {
00369 local string NewWeapon;
00370
00371 if (Initialized)
00372 {
00373 NewWeapon = FavoriteWeaponCombo.GetValue2();
00374 if(NewWeapon == "None")
00375 BotInfo.FavoriteWeapon[ConfigureBot] = "";
00376 else
00377 BotInfo.FavoriteWeapon[ConfigureBot] = NewWeapon;
00378 }
00379 }
00380
00381 function CampingChanged()
00382 {
00383 if (Initialized)
00384 BotInfo.Camping[ConfigureBot] = (CampingSlider.GetValue() / 100);
00385 }
00386
00387 function StrafingAbilityChanged()
00388 {
00389 if (Initialized)
00390 BotInfo.StrafingAbility[ConfigureBot] = (StrafingAbilitySlider.GetValue() / 4) - 1;
00391 }
00392
00393 function AlertnessChanged()
00394 {
00395 if (Initialized)
00396 BotInfo.Alertness[ConfigureBot] = (AlertnessSlider.GetValue() / 100) - 1;
00397 }
00398
00399 function AccuracyChanged()
00400 {
00401 if (Initialized)
00402 BotInfo.BotAccuracy[ConfigureBot] = (AccuracySlider.GetValue() / 100) - 1;
00403 }
00404
00405 function CombatStyleChanged()
00406 {
00407 if (Initialized)
00408 BotInfo.CombatStyle[ConfigureBot] = float(CombatStyleCombo.GetValue2());
00409 }
00410
00411 function SkillChanged()
00412 {
00413 if (Initialized)
00414 BotInfo.BotSkills[ConfigureBot] = SkillSlider.GetValue() - 3;
00415 }
00416
00417 function UseSelected()
00418 {
00419 if (Initialized)
00420 {
00421 // store the stuff in the required botinfo
00422 BotInfo.SetBotClass(ClassCombo.GetValue2(), ConfigureBot);
00423 BotInfo.SetBotSkin(SkinCombo.GetValue2(), ConfigureBot);
00424 BotInfo.SetBotFace(FaceCombo.GetValue2(), ConfigureBot);
00425 BotInfo.SetBotTeam(Int(TeamCombo.GetValue2()), ConfigureBot);
00426 }
00427
00428 // setup the mesh window appropriately
00429 MeshWindow.SetMeshString(NewPlayerClass.Default.SelectionMesh);
00430 MeshWindow.ClearSkins();
00431 NewPlayerClass.static.SetMultiSkin(MeshWindow.MeshActor, SkinCombo.GetValue2(), FaceCombo.GetValue2(), Int(TeamCombo.GetValue2()));
00432 }
00433
00434 function SaveConfigs()
00435 {
00436 Super.SaveConfigs();
00437 if(BotInfo != None)
00438 BotInfo.SaveConfig();
00439 }
00440
00441 function BeforePaint(Canvas C, float X, float Y)
00442 {
00443 local int ControlWidth, ControlLeft, ControlRight;
00444 local int CenterWidth, CenterPos;
00445 local float W;
00446
00447 W = Min(WinWidth, 220);
00448
00449 ControlWidth = W/3;
00450 ControlLeft = (W/2 - ControlWidth)/2;
00451 ControlRight = W/2 + ControlLeft;
00452
00453 CenterWidth = (W/7)*6;
00454 CenterPos = (W - CenterWidth)/2;
00455 Super.BeforePaint(C, X, Y);
00456
00457 FavoriteWeaponCombo.SetSize(CenterWidth, 1);
00458 FavoriteWeaponCombo.WinLeft = CenterPos;
00459 FavoriteWeaponCombo.EditBoxWidth = 105;
00460
00461 AccuracySlider.SetSize(CenterWidth, 1);
00462 AccuracySlider.WinLeft = CenterPos;
00463 AccuracySlider.SliderWidth = 105;
00464
00465 SkillSlider.SetSize(CenterWidth, 1);
00466 SkillSlider.WinLeft = CenterPos;
00467 SkillSlider.SliderWidth = 105;
00468
00469 AlertnessSlider.SetSize(CenterWidth, 1);
00470 AlertnessSlider.WinLeft = CenterPos;
00471 AlertnessSlider.SliderWidth = 105;
00472
00473 CampingSlider.SetSize(CenterWidth, 1);
00474 CampingSlider.WinLeft = CenterPos;
00475 CampingSlider.SliderWidth = 105;
00476
00477 StrafingAbilitySlider.SetSize(CenterWidth, 1);
00478 StrafingAbilitySlider.WinLeft = CenterPos;
00479 StrafingAbilitySlider.SliderWidth = 105;
00480
00481 CombatStyleCombo.SetSize(CenterWidth, 1);
00482 CombatStyleCombo.WinLeft = CenterPos;
00483 CombatStyleCombo.EditBoxWidth = 105;
00484
00485 JumpyCheck.SetSize(CenterWidth-105+16, 1);
00486 JumpyCheck.WinLeft = CenterPos;
00487
00488 VoicePackCombo.SetSize(CenterWidth, 1);
00489 VoicePackCombo.WinLeft = CenterPos;
00490 VoicePackCombo.EditBoxWidth = 105;
00491 }
00492
00493 defaultproperties
00494 {
00495 SkillText="Skill Adjust"
00496 SkillHelp="Adjust this bot's skill up or down, from the base skill level."
00497 VoicePackText="Voice"
00498 VoicePackHelp="Choose a voice for your player's taunts and commands."
00499 FavoriteWeaponText="Favorite Weapon:"
00500 FavoriteWeaponHelp="Select this bot's favorite weapon."
00501 NoFavoriteWeapon="(no favorite)"
00502 AccuracyText="Accuracy:"
00503 AccuracyHelp="Change this bot's weapon accuracy. The cental position is normal, far left is low accuracy, far right is high accuracy."
00504 AlertnessText="Alertness:"
00505 AlertnessHelp="Change this bot's alertness. The central position is normal."
00506 CampingText="Camping:"
00507 CampingHelp="Change this bot's willingness to camp."
00508 StrafingAbilityText="Strafing:"
00509 StrafingAbilityHelp="Change the amount this bot likes to strafe."
00510 CombatStyleText="Combat Style:"
00511 CombatStyleHelp="Select this bot's combat style."
00512 CombatStyleValues(1)=0.500000
00513 CombatStyleValues(2)=1.000000
00514 CombatStyleValues(3)=-0.500000
00515 CombatStyleValues(4)=-1.000000
00516 CombatStyleNames(0)="Normal"
00517 CombatStyleNames(1)="Aggressive"
00518 CombatStyleNames(2)="Berserk"
00519 CombatStyleNames(3)="Cautious"
00520 CombatStyleNames(4)="Avoidant"
00521 JumpyText="Jumpy Behavior:"
00522 JumpyHelp="This bot is inclined to jump excessively around the level, like some players do."
00523 }
|