Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 00296 00297 00298 00299 00300 00301 00302 00303 00304 00305 00306 00307 00308 00309 00310 00311 00312 00313 00314 00315 00316 00317 00318 00319 00320 00321 00322 00323 00324 00325 00326 00327 00328 00329 00330 00331 00332 00333 00334 00335 00336 00337 00338 00339 00340 00341 00342 00343 00344 00345 00346 00347 00348 00349 00350 00351 00352 00353 00354 00355 00356 00357 00358 00359 00360 00361 00362 00363 00364 00365 00366 00367 00368 00369 00370 00371 00372 00373 00374 00375 00376 00377 00378 00379 00380 00381 00382 00383 00384 00385 00386 00387 00388 00389 00390 00391 00392 00393 00394 00395 00396 00397 00398 00399 00400 00401 00402 00403 00404 00405 00406 00407 00408 00409 00410 00411 00412 00413 00414 00415 00416 00417 00418 00419 00420 00421 00422 00423 00424 00425 00426 00427 00428 00429 00430 00431 00432 00433 00434 00435 00436 00437 00438 00439 00440 00441 00442 00443 00444 00445 00446 00447 00448 00449 00450 00451 00452 00453 00454 00455 00456 00457 00458 00459 00460 00461 00462 00463 00464 00465 00466 00467 00468 00469 00470 00471 00472 00473 00474 00475 00476 00477 00478 00479 00480 00481 00482 00483 00484 00485 00486 00487 00488 00489 00490 00491 00492 00493 00494 00495 00496 00497 00498 00499 00500 00501 00502 00503 00504 00505 00506 00507 00508 00509 00510 00511 00512 00513 00514 00515 00516 00517 00518 00519 00520 00521 00522 00523 00524 00525 00526 00527 00528 00529 00530 00531 00532 00533 00534 00535 00536 00537 00538 00539 00540 00541 00542 00543 00544 00545 00546 00547 00548 00549 00550 00551 00552 00553 00554 00555 00556 00557 00558 00559 00560 00561 00562 00563 00564 00565 00566 00567 00568 00569 00570 00571 00572 00573 00574 00575 00576 00577 00578 00579 00580 00581 00582 00583 00584 00585 00586 00587 00588 00589 00590 00591 00592 00593 00594 00595 00596 00597 00598 00599 00600 00601 00602 00603 00604 00605 00606 00607 00608 00609 00610 00611 00612 00613 00614 00615 00616 00617 00618 00619 00620 00621 00622 00623 00624 00625 00626 00627 00628 00629 00630 00631 00632 00633 00634 00635 00636 00637 00638 00639 00640 00641 00642 00643 00644 00645 00646 00647 00648 00649 00650 00651 00652 00653 00654 00655 00656 00657 00658 00659 00660 00661 00662 00663 00664 00665 00666 00667 00668 00669 00670 00671 00672 00673 00674 00675 00676 00677 00678 00679 00680 00681 00682 00683 00684 00685 00686 00687 00688 00689 00690 00691 00692 00693 00694 00695 00696 00697 00698 00699 00700 00701 00702 00703 00704 00705 00706 00707 00708 00709 00710 00711 00712 00713 00714 00715 00716 00717 00718 00719 00720 00721 00722 00723 00724 00725 00726 00727 00728 00729 00730 00731 00732 00733 00734 00735 00736 00737 00738 00739 00740 00741 00742 00743 00744 00745 00746 00747 00748 00749 00750 00751 00752 00753 00754 00755 00756 00757 00758 00759 00760 00761 00762 00763 00764 00765 00766 00767 00768 00769 00770 00771 00772 00773 00774 00775 00776 00777 00778 00779 00780 00781 00782 00783 00784 00785 00786 00787 00788 00789 00790 00791 00792 00793 00794 00795 00796 00797 00798 00799 00800 00801 00802 00803 00804 00805 00806 00807 00808 00809 00810 00811 00812 00813 00814 00815 00816 00817 00818 00819 00820 00821 00822 00823 00824 00825 00826 00827 00828 00829 00830 00831 00832 00833 00834 00835 00836 00837 00838 00839 00840 00841 00842 00843 00844 00845 00846 00847 00848 00849 00850 00851 00852 00853 00854 00855 00856 00857 00858 00859 00860 00861 00862 00863 00864 00865 00866 00867 00868 00869 00870 00871 00872 00873 00874 00875 00876 00877 00878 00879 00880 00881 00882 00883 00884 00885 00886 00887 00888 00889 00890 00891 00892 00893 00894 00895 00896 00897 00898 00899 00900 00901 00902 00903 00904 00905 00906 00907 00908 00909 00910 00911 00912 00913 00914 00915 00916 00917 00918 00919 00920 00921 00922 00923 00924 00925 00926 00927 00928 00929 00930 00931 00932 00933 00934 00935 00936 00937 00938 00939 00940 00941 00942 00943 00944 00945 00946 00947 00948 00949 00950 00951 00952 00953 00954 00955 00956 00957 00958 00959 00960 00961 00962 00963 00964 00965 00966 00967 00968 00969 00970 00971 00972 00973 00974 00975 00976 00977 00978 00979 00980 00981 00982 00983 00984 00985 00986 00987 00988 00989 00990 00991 00992 00993 00994 00995 00996 00997 00998 00999 01000 01001 01002 01003 01004 01005 01006 01007 01008 01009 01010 01011 01012 01013 01014 01015 01016 01017 01018 01019 01020 01021 01022 01023 01024 01025 01026 01027 01028 01029 01030 01031 01032 01033 01034 01035 01036 01037 01038 01039 01040 01041 01042 01043 01044 01045 01046 01047 01048 01049 01050 01051 01052 01053 01054 01055 01056 01057 01058 01059 01060 01061 01062 01063 01064 01065 01066 01067 01068 01069 01070 01071 01072 01073 01074 01075 01076 01077 01078 01079 01080 01081 01082 01083 01084 01085 01086 01087 01088 01089 01090 01091 01092 01093 01094 01095 01096 01097 01098 01099 01100 01101 01102 01103 01104 01105 01106 01107 01108 01109 01110 01111 01112 01113 01114 01115 01116 01117 01118 01119 01120 01121 01122 01123 01124 01125 01126 01127 01128 01129 01130 01131 01132 01133 01134 01135 01136 01137 01138 01139 01140 01141 01142 01143 01144 01145 01146 01147 01148 01149 01150 01151 01152 01153 01154 01155 01156 01157 01158 01159 01160 01161 01162 01163 01164 01165 01166 01167 01168 01169 01170 01171 01172 01173 01174 01175 01176 01177 01178 01179 01180 01181 01182 01183 01184 01185 01186 01187 01188 01189 01190 01191 01192 01193 01194 01195 01196 01197 01198 01199 01200 01201 01202 01203 01204 01205 01206 01207 01208 01209 01210 01211 01212 01213 01214 01215 01216 01217 01218 01219 01220 01221 01222 01223 01224 01225 01226 01227 01228 01229 01230 01231 01232 01233 01234 01235 01236 01237 01238 01239 01240 01241 01242 01243 01244 01245 01246 01247 01248 01249 01250 01251 01252 01253 01254 01255 01256 01257 01258 01259 01260 01261 01262 01263 01264 01265 01266 01267 01268 01269 01270 01271 01272 01273 01274 01275 01276 01277 01278 01279 01280 01281 01282 01283 01284 01285 01286 01287 01288 01289 01290 01291 01292 01293 01294 01295 01296 01297 01298 01299 01300 01301 01302 01303 01304 01305 01306 01307 01308 01309 01310 01311 01312 01313 01314 01315 01316 01317 01318 01319 01320 01321 01322 01323 01324 01325 01326 01327 01328 01329 01330 01331 01332 01333 01334 01335 01336 01337 01338 01339 01340 01341 01342 01343 01344 01345 01346 01347 01348 01349 01350 01351 01352 01353 01354 01355 01356 01357 01358 01359 01360 01361 01362 01363 01364 01365 01366 01367 01368 01369 01370 01371 01372 01373 01374 01375 01376 01377 01378 01379 01380 01381 01382 01383 01384 01385 01386 01387 01388 01389 01390 01391 01392 01393 01394 01395 01396 01397 01398 01399 01400 01401 01402 01403 01404 01405 01406 01407 01408 01409 01410 01411 01412 01413 01414 01415 01416 01417 01418 01419 01420 01421 01422 01423 01424 01425 01426 01427 01428 01429 01430 01431 01432 01433 01434 01435 01436 01437 01438 01439 01440 01441 01442 01443 01444 01445 01446 01447 01448 01449 01450 01451 01452 01453 01454 01455 01456 01457 01458 01459 01460 01461 01462 01463 01464 01465 01466 01467 01468 01469 01470 01471 01472 01473 01474 01475 01476 01477 01478 01479 01480 01481 01482 01483 01484 01485 01486 01487 01488 01489 01490 01491 01492 01493 01494 01495 01496 01497 01498 01499 01500 01501 01502 01503 01504 01505 01506 01507 01508 01509 01510 01511 01512 01513 01514 01515 01516 01517 01518 01519 01520 01521 01522 01523 01524 01525 01526 01527 01528 01529 01530 01531 01532 01533 01534 01535 01536 01537 01538 01539 01540 01541 01542 01543 01544 01545 01546 01547 01548 01549 01550 01551 01552 01553 01554 01555 01556 01557 01558 01559 01560 01561 01562 01563 01564 01565 01566 01567 01568 01569 01570 01571 01572 01573 01574 01575 01576 01577 01578 01579 01580 01581 01582 01583 01584 01585 01586 01587 01588 01589 01590 01591 01592 01593 01594 01595 |
//============================================================================= // DeathMatchPlus. //============================================================================= class DeathMatchPlus extends TournamentGameInfo config; // Sounds #exec OBJ LOAD FILE=..\Sounds\Announcer.uax var() globalconfig int MinPlayers; // bots fill in to guarantee this level in net game var() globalconfig float AirControl; var() config int FragLimit; var() config int TimeLimit; // time limit in minutes var() globalconfig bool bChangeLevels; var() globalconfig bool bHardCoreMode; var bool bChallengeMode; var() globalconfig bool bMegaSpeed; var() globalconfig bool bAltScoring; var() config bool bMultiWeaponStay; var() config bool bForceRespawn; var bool bAlwaysForceRespawn; var bool bDontRestart; var bool bAlreadyChanged; var bool bFirstBlood; var() globalconfig bool bTournament; var bool bRequireReady; var() bool bNoviceMode; var() globalconfig int NetWait; // time to wait for players in netgames w/ bNetReady (typically team games) var() globalconfig int RestartWait; var config bool bUseTranslocator; var bool bJumpMatch; var bool bThreePlus; var bool bFulfilledSpecial; var bool bNetReady; var bool bRatedTranslocator; var bool bStartMatch; var int RemainingTime, ElapsedTime; var int CountDown, StartCount; var localized string StartUpMessage; var localized string TourneyMessage; var localized string WaitingMessage1; var localized string WaitingMessage2; var localized string ReadyMessage; var localized string NotReadyMessage; var localized string CountDownMessage; var localized string StartMessage; var localized string GameEndedMessage; var localized string SingleWaitingMessage; var localized string gamegoal; var float LastTauntTime; var NavigationPoint LastStartSpot; var() config int MaxCommanders; var int NumCommanders; var bool bTutorialGame; // Bot related info var int NumBots; var int RemainingBots; var int LastTaunt[4]; var() globalconfig int InitialBots; var ChallengeBotInfo BotConfig; var localized string NoNameChange, OvertimeMessage; var class<ChallengeBotInfo> BotConfigType; // Player rating variables for single player rated games var float PlayerRating, AvgOpponentRating; var int NumOpp, WinCount, LoseCount; var PlayerPawn RatedPlayer; var int IDnum; var RatedMatchInfo RatedMatchConfig; var float EndTime; var int LadderTypeIndex; var LadderInventory RatedGameLadderObj; function PostBeginPlay() { local string NextPlayerClass; local int i; if ( bAlternateMode ) { bVeryLowGore = true; bLowGore = true; } BotConfig = spawn(BotConfigType); if ( Level.NetMode == NM_Standalone ) RemainingBots = InitialBots; else RemainingBots = 0; Super.PostBeginPlay(); GameReplicationInfo.RemainingTime = RemainingTime; } function PreCacheReferences() { //never called - here to force precaching of meshes spawn(class'TMale1'); spawn(class'TMale2'); spawn(class'TFemale1'); spawn(class'TFemale2'); spawn(class'ImpactHammer'); spawn(class'Translocator'); spawn(class'Enforcer'); spawn(class'UT_Biorifle'); spawn(class'ShockRifle'); spawn(class'PulseGun'); spawn(class'Ripper'); spawn(class'Minigun2'); spawn(class'UT_FlakCannon'); spawn(class'UT_Eightball'); spawn(class'SniperRifle'); } function CheckReady() { if ( (FragLimit == 0) && (TimeLimit == 0) ) { TimeLimit = 20; RemainingTime = 60 * TimeLimit; } } // // Set gameplay speed. // function SetGameSpeed( Float T ) { GameSpeed = FMax(T, 0.1); if ( bHardCoreMode ) { if ( bChallengeMode ) Level.TimeDilation = 1.25 * GameSpeed; else Level.TimeDilation = 1.1 * GameSpeed; } else Level.TimeDilation = GameSpeed; SaveConfig(); SetTimer(Level.TimeDilation, true); } function PlayTeleportEffect( actor Incoming, bool bOut, bool bSound) { local UTTeleportEffect PTE; if ( bRequireReady && (Countdown > 0) ) return; if ( Incoming.bIsPawn && (Incoming.Mesh != None) ) { if ( bSound ) { PTE = Spawn(class'UTTeleportEffect',Incoming,, Incoming.Location, Incoming.Rotation); PTE.Initialize(Pawn(Incoming), bOut); PTE.PlaySound(sound'Resp2A',, 10.0); } } } // Parse options for this game... event InitGame( string Options, out string Error ) { local string InOpt; Super.InitGame(Options, Error); RemainingTime = 60 * TimeLimit; SetGameSpeed(GameSpeed); FragLimit = GetIntOption( Options, "FragLimit", FragLimit ); TimeLimit = GetIntOption( Options, "TimeLimit", TimeLimit ); MaxCommanders = GetIntOption( Options, "MaxCommanders", MaxCommanders ); InOpt = ParseOption( Options, "CoopWeaponMode"); if ( InOpt != "" ) { log("CoopWeaponMode: "$bool(InOpt)); bCoopWeaponMode = bool(InOpt); } IDnum = -1; IDnum = GetIntOption( Options, "Tournament", IDnum ); if ( IDnum > 0 ) { bRatedGame = true; TimeLimit = 0; RemainingTime = 0; } if ( bTournament ) { bRequireReady = true; CheckReady(); } if ( Level.NetMode == NM_StandAlone ) { bRequireReady = true; CountDown = 1; } if ( !bRequireReady && (Level.NetMode != NM_Standalone) ) { bRequireReady = true; bNetReady = true; } } // Set game settings based on ladder information. // Called when RatedPlayer logs in. function InitRatedGame(LadderInventory LadderObj, PlayerPawn LadderPlayer) { local class<RatedMatchInfo> RMI; local Weapon W; FragLimit = LadderObj.CurrentLadder.Default.FragLimits[IDnum]; RatedGameLadderObj = LadderObj; if (LadderObj.CurrentLadder.Default.TimeLimits[IDnum] > 0) TimeLimit = LadderObj.CurrentLadder.Default.TimeLimits[IDnum]; bJumpMatch = false; bHardCoreMode = true; bRequireReady = true; bMegaSpeed = false; CountDown = 1; bRatedGame = true; bCoopWeaponMode = false; bUseTranslocator = bRatedTranslocator; ForEach AllActors(class'Weapon', W) W.bWeaponStay = false; RatedPlayer = LadderPlayer; // Set up RatedBotConfig for this game BotConfig.bAdjustSkill = false; RMI = LadderObj.CurrentLadder.Static.GetMatchConfigType(IDnum); RatedMatchConfig = spawn(RMI); RemainingBots = RatedMatchConfig.NumBots; Difficulty = LadderObj.TournamentDifficulty + RatedMatchConfig.ModifiedDifficulty; if ( Difficulty >= 4 ) { bNoviceMode = false; Difficulty = Difficulty - 4; } else { if ( Difficulty > 3 ) { Difficulty = 3; bThreePlus = true; } bNoviceMode = true; } // Update GRI InitGameReplicationInfo(); // Update Logged Info if (bLocalLog && bLoggingGame) { LogGameParameters(LocalLog); } if (bWorldLog && bLoggingGame) { LogGameParameters(WorldLog); } PlayStartupMessage(LadderPlayer); LadderPlayer.SetProgressTime(6); } /* AcceptInventory() Examine the passed player's inventory, and accept or discard each item * AcceptInventory needs to gracefully handle the case of some inventory being accepted but other inventory not being accepted (such as the default weapon). There are several things that can go wrong: A weapon's AmmoType not being accepted but the weapon being accepted -- the weapon should be killed off. Or the player's selected inventory item, active weapon, etc. not being accepted, leaving the player weaponless or leaving the HUD inventory rendering messed up (AcceptInventory should pick another applicable weapon/item as current). */ function AcceptInventory(pawn PlayerPawn) { local inventory Inv; local LadderInventory LadderObj; // DeathMatchPlus accepts LadderInventory for( Inv=PlayerPawn.Inventory; Inv!=None; Inv=Inv.Inventory ) { if (Inv.IsA('LadderInventory')) { LadderObj = LadderInventory(Inv); } else Inv.Destroy(); } PlayerPawn.Weapon = None; PlayerPawn.SelectedItem = None; AddDefaultInventory( PlayerPawn ); } function bool SetEndCams(string Reason) { local pawn P, Best; local PlayerPawn Player; // find individual winner for ( P=Level.PawnList; P!=None; P=P.nextPawn ) if ( P.bIsPlayer && !P.IsA('Spectator') && ((Best == None) || (P.PlayerReplicationInfo.Score > Best.PlayerReplicationInfo.Score)) ) Best = P; // check for tie for ( P=Level.PawnList; P!=None; P=P.nextPawn ) if ( P.bIsPlayer && (Best != P) && (P.PlayerReplicationInfo.Score == Best.PlayerReplicationInfo.Score) ) { BroadcastLocalizedMessage( DMMessageClass, 0 ); return false; } EndTime = Level.TimeSeconds + 3.0; GameReplicationInfo.GameEndedComments = Best.PlayerReplicationInfo.PlayerName@GameEndedMessage; log( "Game ended at "$EndTime); for ( P=Level.PawnList; P!=None; P=P.nextPawn ) { Player = PlayerPawn(P); if ( Player != None ) { if (!bTutorialGame) PlayWinMessage(Player, (Player == Best)); Player.bBehindView = true; if ( Player == Best ) Player.ViewTarget = None; else Player.ViewTarget = Best; Player.ClientGameEnded(); } P.GotoState('GameEnded'); } CalcEndStats(); return true; } function PlayWinMessage(PlayerPawn Player, bool bWinner) { if ( Player.IsA('TournamentPlayer') ) TournamentPlayer(Player).PlayWinMessage(bWinner); } function NotifySpree(Pawn Other, int num) { local Pawn P; if ( num == 5 ) num = 0; else if ( num == 10 ) num = 1; else if ( num == 15 ) num = 2; else if ( num == 20 ) num = 3; else if ( num == 25 ) num = 4; else return; for ( P=Level.PawnList; P!=None; P=P.NextPawn ) if ( P.IsA('TournamentPlayer') ) P.ReceiveLocalizedMessage( class'KillingSpreeMessage', Num, Other.PlayerReplicationInfo ); } function EndSpree(Pawn Killer, Pawn Other) { local Pawn P; if ( !Other.bIsPlayer ) return; for ( P=Level.PawnList; P!=None; P=P.NextPawn ) if ( P.IsA('TournamentPlayer') ) { if ( (Killer == None) || !Killer.bIsPlayer ) TournamentPlayer(P).EndSpree(None, Other.PlayerReplicationInfo); else TournamentPlayer(P).EndSpree(Killer.PlayerReplicationInfo, Other.PlayerReplicationInfo); } } function ScoreKill(pawn Killer, pawn Other) { Super.ScoreKill(Killer, Other); if ( bAltScoring && (Killer != Other) && (killer != None) ) Other.PlayerReplicationInfo.Score -= 1; } // Monitor killed messages for fraglimit function Killed(pawn killer, pawn Other, name damageType) { local int NextTaunt, i; local bool bAutoTaunt, bEndOverTime; local Pawn P, Best; if ( (damageType == 'Decapitated') && (Killer != Other) && (Killer != None) ) { if (Level.Game.LocalLog != None) Level.Game.LocalLog.LogSpecialEvent("headshot", Killer.PlayerReplicationInfo.PlayerID, Other.PlayerReplicationInfo.PlayerID); if (Level.Game.WorldLog != None) Level.Game.WorldLog.LogSpecialEvent("headshot", Killer.PlayerReplicationInfo.PlayerID, Other.PlayerReplicationInfo.PlayerID); Killer.ReceiveLocalizedMessage( class'DecapitationMessage' ); } Super.Killed(killer, Other, damageType); if ( Other.Spree > 4 ) EndSpree(Killer, Other); Other.Spree = 0; if ( !bTeamGame ) { if ( bOverTime ) { bEndOverTime = true; //check for clear winner now // find individual winner for ( P=Level.PawnList; P!=None; P=P.nextPawn ) if ( P.bIsPlayer && ((Best == None) || (P.PlayerReplicationInfo.Score > Best.PlayerReplicationInfo.Score)) ) Best = P; // check for tie for ( P=Level.PawnList; P!=None; P=P.nextPawn ) if ( P.bIsPlayer && (Best != P) && (P.PlayerReplicationInfo.Score == Best.PlayerReplicationInfo.Score) ) bEndOverTime = false; if ( bEndOverTime ) { if ( (FragLimit > 0) && (Best.PlayerReplicationInfo.Score >= FragLimit) ) EndGame("fraglimit"); else EndGame("timelimit"); } } else if ( (FragLimit > 0) && (killer != None) && (killer.PlayerReplicationInfo != None) && (killer.PlayerReplicationInfo.Score >= FragLimit) ) EndGame("fraglimit"); } if ( (killer == None) || (Other == None) ) return; if ( !bFirstBlood ) if ( Killer.bIsPlayer && (Killer != Other) ) if (!Self.IsA('TrainingDM')) { bFirstBlood = True; BroadcastLocalizedMessage( class'FirstBloodMessage', 0, Killer.PlayerReplicationInfo ); } if ( BotConfig.bAdjustSkill && (killer.IsA('PlayerPawn') || Other.IsA('PlayerPawn')) ) { if ( killer.IsA('Bot') ) BotConfig.AdjustSkill(Bot(killer),true); if ( Other.IsA('Bot') ) BotConfig.AdjustSkill(Bot(Other),false); } if ( Other.bIsPlayer && (Killer != None) && Killer.bIsPlayer && (Killer != Other) && (!bTeamGame || (Other.PlayerReplicationInfo.Team != Killer.PlayerReplicationInfo.Team)) ) { Killer.Spree++; if ( Killer.Spree > 4 ) NotifySpree(Killer, Killer.Spree); } bAutoTaunt = ((TournamentPlayer(Killer) != None) && TournamentPlayer(Killer).bAutoTaunt); if ( ((Bot(Killer) != None) || bAutoTaunt) && (Killer != Other) && (DamageType != 'gibbed') && (Killer.Health > 0) && (Level.TimeSeconds - LastTauntTime > 3) ) { LastTauntTime = Level.TimeSeconds; NextTaunt = Rand(class<ChallengeVoicePack>(Killer.PlayerReplicationInfo.VoiceType).Default.NumTaunts); for ( i=0; i<4; i++ ) { if ( NextTaunt == LastTaunt[i] ) NextTaunt = Rand(class<ChallengeVoicePack>(Killer.PlayerReplicationInfo.VoiceType).Default.NumTaunts); if ( i > 0 ) LastTaunt[i-1] = LastTaunt[i]; } LastTaunt[3] = NextTaunt; killer.SendGlobalMessage(None, 'AUTOTAUNT', NextTaunt, 5); } if ( bRatedGame ) RateVs(Other, Killer); } event playerpawn Login ( string Portal, string Options, out string Error, class<playerpawn> SpawnClass ) { local playerpawn NewPlayer; if ( (Level.NetMode != NM_Standalone) && (NumCommanders >= MaxCommanders) && ClassIsChildOf(SpawnClass, class'Commander') ) { Error="Max commanders "$MaxCommanders$" exceeded"; return None; } NewPlayer = Super.Login(Portal, Options, Error, SpawnClass); if ( NewPlayer != None ) { if ( bRatedGame ) NewPlayer.AirControl = 0.35; else NewPlayer.AirControl = AirControl; if ( Left(NewPlayer.PlayerReplicationInfo.PlayerName, 6) == DefaultPlayerName ) { if (Level.Game.WorldLog != None) Level.Game.WorldLog.LogSpecialEvent("forced_name_change", NewPlayer.PlayerReplicationInfo.PlayerName, NewPlayer.PlayerReplicationInfo.PlayerID, DefaultPlayerName$NumPlayers); ChangeName( NewPlayer, (DefaultPlayerName$NumPlayers), false ); } NewPlayer.bAutoActivate = true; if ( (bGameEnded || (bRequireReady && (CountDown > 0))) && !NewPlayer.IsA('Spectator') ) NewPlayer.PlayerRestartState = 'PlayerWaiting'; else NewPlayer.PlayerRestartState = NewPlayer.Default.PlayerRestartState; if ( NewPlayer.IsA('TournamentPlayer') ) { TournamentPlayer(NewPlayer).StartSpot = LastStartSpot; if ( NewPlayer.IsA('Commander') ) NumCommanders++; } } return NewPlayer; } event PostLogin( playerpawn NewPlayer ) { Super.PostLogin(NewPlayer); if ( Level.NetMode == NM_Standalone ) { while ( (RemainingBots > 0) && AddBot() ) RemainingBots--; } else RemainingBots = 0; if ( !bRatedGame ) { PlayStartUpMessage(NewPlayer); NewPlayer.SetProgressTime(6); } } function int ReduceDamage(int Damage, name DamageType, pawn injured, pawn instigatedBy) { if (injured.Region.Zone.bNeutralZone) return 0; if ( instigatedBy == None) return Damage; if ( bHardCoreMode ) Damage *= 1.5; if ( bNoviceMode && !bThreePlus ) { if ( instigatedBy.bIsPlayer && (injured == instigatedby) && (Level.NetMode == NM_Standalone) ) Damage *= 0.5; //skill level modification if ( instigatedBy.IsA('Bot') && injured.IsA('PlayerPawn') ) { if ( ((instigatedBy.Weapon != None) && instigatedBy.Weapon.bMeleeWeapon) || ((injured.Weapon != None) && injured.Weapon.bMeleeWeapon && (VSize(injured.location - instigatedBy.Location) < 600)) ) Damage = Damage * (0.76 + 0.08 * instigatedBy.skill); else Damage = Damage * (0.25 + 0.15 * instigatedBy.skill); } } return (Damage * instigatedBy.DamageScaling); } function StartMatch() { local Pawn P; local TimedTrigger T; if (LocalLog != None) LocalLog.LogGameStart(); if (WorldLog != None) WorldLog.LogGameStart(); ForEach AllActors(class'TimedTrigger', T) T.SetTimer(T.DelaySeconds, T.bRepeating); if ( Level.NetMode != NM_Standalone ) RemainingBots = 0; GameReplicationInfo.RemainingMinute = RemainingTime; bStartMatch = true; // start players first (in their current startspots) for ( P = Level.PawnList; P!=None; P=P.nextPawn ) if ( P.bIsPlayer && P.IsA('PlayerPawn') ) { if ( bGameEnded ) return; // telefrag ended the game with ridiculous frag limit else if ( !P.IsA('Spectator') ) { P.PlayerRestartState = P.Default.PlayerRestartState; P.GotoState(P.Default.PlayerRestartState); if ( !P.IsA('Commander') ) { if ( !RestartPlayer(P) ) P.GotoState('Dying'); //failed to restart player, so let him try to respawn again } } SendStartMessage(PlayerPawn(P)); } for ( P = Level.PawnList; P!=None; P=P.nextPawn ) if ( P.bIsPlayer && !P.IsA('PlayerPawn') ) { P.RestartPlayer(); if ( P.IsA('Bot') ) Bot(P).StartMatch(); } bStartMatch = false; } function Timer() { local Pawn P; local bool bReady; local int M; Super.Timer(); if ( bNetReady ) { if ( NumPlayers > 0 ) ElapsedTime++; else ElapsedTime = 0; if ( ElapsedTime > NetWait ) { if ( (NumPlayers + NumBots < 4) && NeedPlayers() ) AddBot(); else if ( (NumPlayers + NumBots > 1) || ((NumPlayers > 0) && (ElapsedTime > 2 * NetWait)) ) bNetReady = false; } if ( bNetReady ) { for (P=Level.PawnList; P!=None; P=P.NextPawn ) if ( P.IsA('PlayerPawn') ) PlayerPawn(P).SetProgressTime(2); return; } else { while ( NeedPlayers() ) AddBot(); bRequireReady = false; StartMatch(); } } if ( bRequireReady && (CountDown > 0) ) { while ( (RemainingBots > 0) && AddBot() ) RemainingBots--; for (P=Level.PawnList; P!=None; P=P.NextPawn ) if ( P.IsA('PlayerPawn') ) PlayerPawn(P).SetProgressTime(2); if ( ((NumPlayers == MaxPlayers) || (Level.NetMode == NM_Standalone)) && (RemainingBots <= 0) ) { bReady = true; for (P=Level.PawnList; P!=None; P=P.NextPawn ) if ( P.IsA('PlayerPawn') && !P.IsA('Spectator') && !PlayerPawn(P).bReadyToPlay ) bReady = false; if ( bReady ) { StartCount = 30; CountDown--; if ( CountDown <= 0 ) StartMatch(); else { for ( P = Level.PawnList; P!=None; P=P.nextPawn ) if ( P.IsA('PlayerPawn') ) { PlayerPawn(P).ClearProgressMessages(); if ( (CountDown < 11) && P.IsA('TournamentPlayer') ) TournamentPlayer(P).TimeMessage(CountDown); else PlayerPawn(P).SetProgressMessage(CountDown$CountDownMessage, 0); } } } else if ( StartCount > 8 ) { for ( P = Level.PawnList; P!=None; P=P.nextPawn ) if ( P.IsA('PlayerPawn') ) { PlayerPawn(P).ClearProgressMessages(); PlayerPawn(P).SetProgressTime(2); PlayerPawn(P).SetProgressMessage(WaitingMessage1, 0); PlayerPawn(P).SetProgressMessage(WaitingMessage2, 1); if ( PlayerPawn(P).bReadyToPlay ) PlayerPawn(P).SetProgressMessage(ReadyMessage, 2); else PlayerPawn(P).SetProgressMessage(NotReadyMessage, 2); } } else { StartCount++; if ( Level.NetMode != NM_Standalone ) StartCount = 30; } } else { for ( P = Level.PawnList; P!=None; P=P.nextPawn ) if ( P.IsA('PlayerPawn') ) PlayStartupMessage(PlayerPawn(P)); } } else { if ( bAlwaysForceRespawn || (bForceRespawn && (Level.NetMode != NM_Standalone)) ) For ( P=Level.PawnList; P!=None; P=P.NextPawn ) { if ( P.IsInState('Dying') && P.IsA('PlayerPawn') && P.bHidden ) PlayerPawn(P).ServerReStartPlayer(); } if ( Level.NetMode != NM_Standalone ) { if ( NeedPlayers() ) AddBot(); } else while ( (RemainingBots > 0) && AddBot() ) RemainingBots--; if ( bGameEnded ) { if ( Level.TimeSeconds > EndTime + RestartWait ) RestartGame(); } else if ( !bOverTime && (TimeLimit > 0) ) { GameReplicationInfo.bStopCountDown = false; RemainingTime--; GameReplicationInfo.RemainingTime = RemainingTime; if ( RemainingTime % 60 == 0 ) GameReplicationInfo.RemainingMinute = RemainingTime; if ( RemainingTime <= 0 ) EndGame("timelimit"); } else { ElapsedTime++; GameReplicationInfo.ElapsedTime = ElapsedTime; } } } function bool TooManyBots() { return (NumBots + NumPlayers > MinPlayers); } function bool RestartPlayer( pawn aPlayer ) { local Bot B; local bool bResult; aPlayer.DamageScaling = aPlayer.Default.DamageScaling; B = Bot(aPlayer); if ( (B != None) && (Level.NetMode != NM_Standalone) && TooManyBots() ) { aPlayer.Destroy(); return false; } bResult = Super.RestartPlayer(aPlayer); if ( aPlayer.IsA('TournamentPlayer') ) TournamentPlayer(aPlayer).StartSpot = LastStartSpot; return bResult; } function SendStartMessage(PlayerPawn P) { P.ClearProgressMessages(); P.SetProgressMessage(StartMessage, 0); } function Bot SpawnBot(out NavigationPoint StartSpot) { local bot NewBot; local int BotN; local Pawn P; if ( bRatedGame ) return SpawnRatedBot(StartSpot); Difficulty = BotConfig.Difficulty; if ( Difficulty >= 4 ) { bNoviceMode = false; Difficulty = Difficulty - 4; } else { if ( Difficulty > 3 ) { Difficulty = 3; bThreePlus = true; } bNoviceMode = true; } BotN = BotConfig.ChooseBotInfo(); // Find a start spot. StartSpot = FindPlayerStart(None, 255); if( StartSpot == None ) { log("Could not find starting spot for Bot"); return None; } // Try to spawn the bot. NewBot = Spawn(BotConfig.CHGetBotClass(BotN),,,StartSpot.Location,StartSpot.Rotation); if ( NewBot == None ) log("Couldn't spawn player at "$StartSpot); if ( (bHumansOnly || Level.bHumansOnly) && !NewBot.bIsHuman ) { log("can't add non-human bot to this game"); NewBot.Destroy(); NewBot = None; } if ( NewBot == None ) NewBot = Spawn(BotConfig.CHGetBotClass(0),,,StartSpot.Location,StartSpot.Rotation); if ( NewBot != None ) { // Set the player's ID. NewBot.PlayerReplicationInfo.PlayerID = CurrentID++; NewBot.PlayerReplicationInfo.Team = BotConfig.GetBotTeam(BotN); BotConfig.CHIndividualize(NewBot, BotN, NumBots); NewBot.ViewRotation = StartSpot.Rotation; // broadcast a welcome message. BroadcastMessage( NewBot.PlayerReplicationInfo.PlayerName$EnteredMessage, false ); ModifyBehaviour(NewBot); AddDefaultInventory( NewBot ); NumBots++; if ( bRequireReady && (CountDown > 0) ) NewBot.GotoState('Dying', 'WaitingForStart'); NewBot.AirControl = AirControl; if ( (Level.NetMode != NM_Standalone) && (bNetReady || bRequireReady) ) { // replicate skins for ( P=Level.PawnList; P!=None; P=P.NextPawn ) if ( P.bIsPlayer && (P.PlayerReplicationInfo != None) && P.PlayerReplicationInfo.bWaitingPlayer && P.IsA('PlayerPawn') ) { if ( NewBot.bIsMultiSkinned ) PlayerPawn(P).ClientReplicateSkins(NewBot.MultiSkins[0], NewBot.MultiSkins[1], NewBot.MultiSkins[2], NewBot.MultiSkins[3]); else PlayerPawn(P).ClientReplicateSkins(NewBot.Skin); } } } return NewBot; } function Bot SpawnRatedBot(out NavigationPoint StartSpot) { local bot NewBot; local int BotN; local bool bEnemy; if (RemainingBots > RatedMatchConfig.NumAllies) bEnemy = True; BotN = RatedMatchConfig.ChooseBotInfo(bTeamGame, bEnemy); // Find a start spot. StartSpot = FindPlayerStart(None, 255); if( StartSpot == None ) { log("Could not find starting spot for Bot"); return None; } // Try to spawn the bot. NewBot = Spawn(RatedMatchConfig.GetBotClass(BotN, bTeamGame, bEnemy, RatedPlayer),,,StartSpot.Location,StartSpot.Rotation); if ( NewBot == None ) { if ( (RatedMatchConfig.EnemyTeam == class'RatedTeamInfo7') || (RatedMatchConfig.EnemyTeam == class'RatedTeamInfo8') ) RatedMatchConfig.EnemyTeam = class'RatedTeamInfo3'; log("Couldn't spawn player at "$StartSpot); } if ( NewBot != None ) { // Set the player's ID. NewBot.PlayerReplicationInfo.PlayerID = CurrentID++; RatedMatchConfig.Individualize(NewBot, BotN, NumBots, bTeamGame, bEnemy); NewBot.ViewRotation = StartSpot.Rotation; // broadcast a welcome message. BroadcastMessage( NewBot.PlayerReplicationInfo.PlayerName$EnteredMessage, false ); ModifyBehaviour(NewBot); AddDefaultInventory( NewBot ); NumBots++; if ( bRequireReady && (CountDown > 0) ) NewBot.GotoState('Dying', 'WaitingForStart'); NewBot.AirControl = 0.35; } return NewBot; } function bool ForceAddBot() { // add bot during gameplay if ( Level.NetMode != NM_Standalone ) MinPlayers = Max(MinPlayers+1, NumPlayers + NumBots + 1); AddBot(); } function bool AddBot() { local bot NewBot; local NavigationPoint StartSpot; NewBot = SpawnBot(StartSpot); if ( NewBot == None ) { log("Failed to spawn bot."); return false; } StartSpot.PlayTeleportEffect(NewBot, true); NewBot.PlayerReplicationInfo.bIsABot = True; // Log it. if (LocalLog != None) { LocalLog.LogPlayerConnect(NewBot); LocalLog.FlushLog(); } if (WorldLog != None) { WorldLog.LogPlayerConnect(NewBot); WorldLog.FlushLog(); } return true; } function ModifyBehaviour(Bot NewBot); function PlayStartUpMessage(PlayerPawn NewPlayer) { local int i; NewPlayer.ClearProgressMessages(); // Game Name NewPlayer.SetProgressMessage(GameName, i++); // Optional FragLimit if ( fraglimit > 0 ) NewPlayer.SetProgressMessage(FragLimit@GameGoal, i++); if ( Level.NetMode == NM_Standalone ) NewPlayer.SetProgressMessage(SingleWaitingMessage, i++); else if ( bRequireReady ) NewPlayer.SetProgressMessage(TourneyMessage, i++); } function float PlayerJumpZScaling() { if ( bJumpMatch ) return 3; else if ( bMegaSpeed ) return 1.2; else if ( bHardCoreMode ) return 1.1; else return 1.0; } function AddDefaultInventory( pawn PlayerPawn ) { local Weapon NewWeapon; local Bot B; if ( PlayerPawn.IsA('Spectator') || (bRequireReady && (CountDown > 0)) ) return; // Spawn Automag GiveWeapon(PlayerPawn, "Botpack.Enforcer"); Super.AddDefaultInventory(PlayerPawn); if ( bUseTranslocator && (!bRatedGame || bRatedTranslocator) ) { // Spawn Translocator. if( PlayerPawn.FindInventoryType(class'Translocator')==None ) { newWeapon = Spawn(class'Translocator'); if( newWeapon != None ) { newWeapon.Instigator = PlayerPawn; newWeapon.BecomeItem(); PlayerPawn.AddInventory(newWeapon); newWeapon.GiveAmmo(PlayerPawn); newWeapon.SetSwitchPriority(PlayerPawn); newWeapon.WeaponSet(PlayerPawn); } } } B = Bot(PlayerPawn); if ( B != None ) B.bHasImpactHammer = (B.FindInventoryType(class'ImpactHammer') != None); } function GiveWeapon(Pawn PlayerPawn, string aClassName ) { local class<Weapon> WeaponClass; local Weapon NewWeapon; WeaponClass = class<Weapon>(DynamicLoadObject(aClassName, class'Class')); if( PlayerPawn.FindInventoryType(WeaponClass) != None ) return; newWeapon = Spawn(WeaponClass); if( newWeapon != None ) { newWeapon.RespawnTime = 0.0; newWeapon.GiveTo(PlayerPawn); newWeapon.bHeldItem = true; newWeapon.GiveAmmo(PlayerPawn); newWeapon.SetSwitchPriority(PlayerPawn); newWeapon.WeaponSet(PlayerPawn); newWeapon.AmbientGlow = 0; if ( PlayerPawn.IsA('PlayerPawn') ) newWeapon.SetHand(PlayerPawn(PlayerPawn).Handedness); else newWeapon.GotoState('Idle'); PlayerPawn.Weapon.GotoState('DownWeapon'); PlayerPawn.PendingWeapon = None; PlayerPawn.Weapon = newWeapon; } } function byte AssessBotAttitude(Bot aBot, Pawn Other) { local float skillmod; if ( bNoviceMode ) skillmod = 0.3; else skillmod = 0.2 - aBot.skill * 0.06; if ( aBot.bKamikaze ) return 1; else if ( Other.IsA('TeamCannon') || (aBot.RelativeStrength(Other) > aBot.Aggressiveness + skillmod) ) return 0; else return 1; } function float GameThreatAdd(Bot aBot, Pawn Other) { return 0; } // AllowTranslocation - return true if Other can teleport to Dest function bool AllowTranslocation(Pawn Other, vector Dest ) { return true; } function bool CanTranslocate(Bot aBot) { if ( !bUseTranslocator || (bRatedGame && !bRatedTranslocator) ) return false; return ( (aBot.MyTranslocator != None) && (aBot.MyTranslocator.TTarget == None) ); } function PickAmbushSpotFor(Bot aBot) { local NavigationPoint N; for ( N=Level.NavigationPointList; N!=None; N=N.NextNavigationPoint ) if ( N.IsA('Ambushpoint') && !N.taken && ((aBot.AmbushSpot == None) || (VSize(aBot.Location - aBot.Ambushspot.Location) > VSize(aBot.Location - N.Location))) ) aBot.Ambushspot = Ambushpoint(N); } function RateVs(Pawn Other, Pawn Killer) { local int numopp, Win; local float oppRating, K, We; Local PlayerPawn P; Local Bot B; if ( Killer.IsA('PlayerPawn') ) { P = PlayerPawn(Killer); B = Bot(Other); Win = 1; WinCount++; } else if ( Other.IsA('PlayerPawn') ) { LoseCount++; P = PlayerPawn(Other); B = Bot(Killer); } else return; if ( B == None ) oppRating = PlayerRating - 400; else oppRating = FMin(B.GetRating(), PlayerRating + 400); numopp++; AvgOpponentRating = (AvgOpponentRating * (numopp - 1) + oppRating)/numopp; if ( numopp < 20 ) { PlayerRating = AvgOpponentRating + 400 * (WinCount - LoseCount)/numopp; } else { if ( oppRating < PlayerRating - 400 ) return; if ( PlayerRating < 2100 ) K = 32; else if ( PlayerRating < 2400 ) K = 24; else K = 16; We = 1/(10^((PlayerRating - opprating)/400) + 1); PlayerRating = PlayerRating + K * (Win - We); /* FOLLOWING NOT DONE - do at end of level FIXME Pre-tournament Rating Post-tournament Rating 0-2099 2100-2399 Ra = 2100 + (Rn-2100) x 0.75 2100-2399 0-2099 Ra = 2100 + (Rn-2100) x 1.33 2100-2399 2400-3000 Ra = 2400 + (Rn-2400) x 0.66 2400-3000 2100-2399 Ra = 2400 + (Rn-2400) x 1.50 */ } } function bool SuccessfulGame() { local Pawn P; for ( P=Level.PawnList; P!=None; P=P.NextPawn ) if ( P.bIsPlayer && (P != RatedPlayer) ) if ( P.PlayerReplicationInfo.Score >= RatedPlayer.PlayerReplicationInfo.Score ) return false; return true; } // Commented out for release version. function Skip() { if (bRatedGame) { RatedGameLadderObj.LastMatchType = LadderTypeIndex; RatedGameLadderObj.PendingChange = LadderTypeIndex; if (IDnum < RatedGameLadderObj.CurrentLadder.Default.Matches-1) RatedGameLadderObj.PendingPosition = IDnum+1; RatedGameLadderObj.PendingRank = RatedGameLadderObj.CurrentLadder.Default.RankedGame[IDnum]; RatedPlayer.ClientTravel("UT-Logo-Map.unr"$"?Game=Botpack.LadderTransition", TRAVEL_Absolute, True); return; } } function SkipAll() { if (bRatedGame) { RatedGameLadderObj.DMPosition = class'LadderDMGOTY'.Default.Matches - 1; RatedGameLadderObj.DMRank = 6; RatedGameLadderObj.DOMPosition = class'LadderDOM'.Default.Matches - 1; RatedGameLadderObj.DOMRank = 6; RatedGameLadderObj.CTFPosition = class'LadderCTFGOTY'.Default.Matches - 1; RatedGameLadderObj.CTFRank = 6; RatedGameLadderObj.ASPosition = class'LadderAS'.Default.Matches - 1; RatedGameLadderObj.ASRank = 6; RatedGameLadderObj.ChalPosition = class'LadderChal'.Default.Matches - 1; RatedGameLadderObj.ChalRank = 6; RatedGameLadderObj.LastMatchType = LadderTypeIndex; RatedGameLadderObj.PendingChange = LadderTypeIndex; RatedGameLadderObj.PendingPosition = 0; RatedGameLadderObj.PendingRank = 0; RatedPlayer.ClientTravel("UT-Logo-Map.unr"$"?Game=Botpack.LadderTransition", TRAVEL_Absolute, True); return; } } function bool CanSpectate( pawn Viewer, actor ViewTarget ) { if ( ViewTarget.bIsPawn && (Pawn(ViewTarget).PlayerReplicationInfo != None) && Pawn(ViewTarget).PlayerReplicationInfo.bIsSpectator ) return false; return ( (!bRatedGame && (Level.NetMode == NM_Standalone)) || Viewer.PlayerReplicationInfo.bIsSpectator ); } function bool ShouldRespawn(Actor Other) { return ( (Inventory(Other) != None) && (Inventory(Other).ReSpawnTime!=0.0) ); } function ChangeName(Pawn Other, string S, bool bNameChange) { local pawn APlayer; if ( S == "" ) return; S = left(S,24); if (Other.PlayerReplicationInfo.PlayerName~=S) return; APlayer = Level.PawnList; While ( APlayer != None ) { if ( APlayer.bIsPlayer && (APlayer.PlayerReplicationInfo.PlayerName~=S) ) { Other.ClientMessage(S$NoNameChange); return; } APlayer = APlayer.NextPawn; } Other.PlayerReplicationInfo.OldName = Other.PlayerReplicationInfo.PlayerName; Other.PlayerReplicationInfo.PlayerName = S; if ( bNameChange && !Other.IsA('Spectator') ) BroadcastLocalizedMessage( DMMessageClass, 2, Other.PlayerReplicationInfo ); if (LocalLog != None) LocalLog.LogNameChange(Other); if (WorldLog != None) WorldLog.LogNameChange(Other); } /* FindPlayerStart() returns the 'best' player start for this player to start from. Re-implement for each game type */ function NavigationPoint FindPlayerStart(Pawn Player, optional byte InTeam, optional string incomingName) { local PlayerStart Dest, Candidate[16], Best; local float Score[16], BestScore, NextDist; local pawn OtherPlayer; local int i, num; local Teleporter Tel; local NavigationPoint N, LastPlayerStartSpot; if ( bStartMatch && (Player != None) && Player.IsA('TournamentPlayer') && (Level.NetMode == NM_Standalone) && (TournamentPlayer(Player).StartSpot != None) ) return TournamentPlayer(Player).StartSpot; if( incomingName!="" ) foreach AllActors( class 'Teleporter', Tel ) if( string(Tel.Tag)~=incomingName ) return Tel; //choose candidates for ( N=Level.NavigationPointList; N!=None; N=N.NextNavigationPoint ) { Dest = PlayerStart(N); if ( (Dest != None) && Dest.bEnabled && !Dest.Region.Zone.bWaterZone ) { if (num<16) Candidate[num] = Dest; else if (Rand(num) < 16) Candidate[Rand(16)] = Dest; num++; } } if (num == 0 ) foreach AllActors( class 'PlayerStart', Dest ) { if (num<16) Candidate[num] = Dest; else if (Rand(num) < 16) Candidate[Rand(16)] = Dest; num++; } if (num>16) num = 16; else if (num == 0) return None; if ( (Player != None) && Player.IsA('TournamentPlayer') && (TournamentPlayer(Player).StartSpot != None) ) LastPlayerStartSpot = TournamentPlayer(Player).StartSpot; //assess candidates for (i=0;i<num;i++) { if ( (Candidate[i] == LastStartSpot) || (Candidate[i] == LastPlayerStartSpot) ) Score[i] = -10000.0; else Score[i] = 3000 * FRand(); //randomize } for ( OtherPlayer=Level.PawnList; OtherPlayer!=None; OtherPlayer=OtherPlayer.NextPawn) if ( OtherPlayer.bIsPlayer && (OtherPlayer.Health > 0) && !OtherPlayer.IsA('Spectator') ) for ( i=0; i<num; i++ ) { if ( OtherPlayer.Region.Zone == Candidate[i].Region.Zone ) { Score[i] -= 1500; NextDist = VSize(OtherPlayer.Location - Candidate[i].Location); if ( NextDist < OtherPlayer.CollisionRadius + OtherPlayer.CollisionHeight ) Score[i] -= 1000000.0; else if ( (NextDist < 2000) && FastTrace(Candidate[i].Location, OtherPlayer.Location) ) Score[i] -= (10000.0 - NextDist); } else if ( NumPlayers + NumBots == 2 ) { Score[i] += 2 * VSize(OtherPlayer.Location - Candidate[i].Location); if ( FastTrace(Candidate[i].Location, OtherPlayer.Location) ) Score[i] -= 10000; } } BestScore = Score[0]; Best = Candidate[0]; for (i=1;i<num;i++) if (Score[i] > BestScore) { BestScore = Score[i]; Best = Candidate[i]; } LastStartSpot = Best; return Best; } function Logout(pawn Exiting) { Super.Logout(Exiting); if ( Exiting.IsA('Bot') ) NumBots--; if ( Exiting.IsA('Commander') ) NumCommanders--; if ( (Level.NetMode != NM_Standalone) && NeedPlayers() && !AddBot() ) RemainingBots++; } function bool NeedPlayers() { return (!bGameEnded && (NumPlayers + NumBots < MinPlayers)); } function RestartGame() { local string NextMap; local MapList myList; // multipurpose don't restart variable if ( bDontRestart ) return; if ( EndTime > Level.TimeSeconds ) // still showing end screen return; // Evaluate a rated game. if ( bRatedGame ) { // Clear out the advancement fields. RatedGameLadderObj.PendingPosition = 0; RatedGameLadderObj.PendingRank = 0; RatedGameLadderObj.PendingChange = 0; // Setup advancement. RatedGameLadderObj.LastMatchType = LadderTypeIndex; if ( SuccessfulGame() ) { RatedGameLadderObj.PendingChange = LadderTypeIndex; if (IDnum < RatedGameLadderObj.CurrentLadder.Default.Matches-1) RatedGameLadderObj.PendingPosition = IDnum+1; // We are advancing to the next match. RatedGameLadderObj.PendingRank = RatedGameLadderObj.CurrentLadder.Default.RankedGame[IDnum]; } RatedPlayer.Health = RatedPlayer.Default.Health; RatedPlayer.ClientTravel("UT-Logo-Map.unr"$"?Game=Botpack.LadderTransition", TRAVEL_Absolute, True); return; } // these server travels should all be relative to the current URL if ( bChangeLevels && !bAlreadyChanged && (MapListType != None) ) { // open a the nextmap actor for this game type and get the next map bAlreadyChanged = true; myList = spawn(MapListType); NextMap = myList.GetNextMap(); myList.Destroy(); if ( NextMap == "" ) NextMap = GetMapName(MapPrefix, NextMap,1); if ( NextMap != "" ) { Level.ServerTravel(NextMap, false); return; } } Level.ServerTravel("?Restart" , false); } function LogGameParameters(StatLog StatLog) { local bool bTemp; if (StatLog == None) return; // hack to make sure weapon stay logging is correct for multiplayer games bTemp = bCoopWeaponMode; if ( Level.Netmode != NM_Standalone ) bCoopWeaponMode = bMultiWeaponStay; Super.LogGameParameters(StatLog); bCoopWeaponMode = bTemp; StatLog.LogEventString(StatLog.GetTimeStamp()$Chr(9)$"game"$Chr(9)$"FragLimit"$Chr(9)$FragLimit); StatLog.LogEventString(StatLog.GetTimeStamp()$Chr(9)$"game"$Chr(9)$"TimeLimit"$Chr(9)$TimeLimit); StatLog.LogEventString(StatLog.GetTimeStamp()$Chr(9)$"game"$Chr(9)$"MultiPlayerBots"$Chr(9)$(MinPlayers > 0)); StatLog.LogEventString(StatLog.GetTimeStamp()$Chr(9)$"game"$Chr(9)$"HardCore"$Chr(9)$bHardCoreMode); StatLog.LogEventString(StatLog.GetTimeStamp()$Chr(9)$"game"$Chr(9)$"MegaSpeed"$Chr(9)$bMegaSpeed); StatLog.LogEventString(StatLog.GetTimeStamp()$Chr(9)$"game"$Chr(9)$"AirControl"$Chr(9)$AirControl); StatLog.LogEventString(StatLog.GetTimeStamp()$Chr(9)$"game"$Chr(9)$"JumpMatch"$Chr(9)$bJumpMatch); StatLog.LogEventString(StatLog.GetTimeStamp()$Chr(9)$"game"$Chr(9)$"UseTranslocator"$Chr(9)$bUseTranslocator); StatLog.LogEventString(StatLog.GetTimeStamp()$Chr(9)$"game"$Chr(9)$"TournamentMode"$Chr(9)$bTournament); if (Level.NetMode == NM_DedicatedServer) StatLog.LogEventString(StatLog.GetTimeStamp()$Chr(9)$"game"$Chr(9)$"NetMode"$Chr(9)$"DedicatedServer"); else if (Level.NetMode == NM_ListenServer) StatLog.LogEventString(StatLog.GetTimeStamp()$Chr(9)$"game"$Chr(9)$"NetMode"$Chr(9)$"ListenServer"); else if (Level.NetMode == NM_Standalone) { if (bRatedGame) StatLog.LogEventString(StatLog.GetTimeStamp()$Chr(9)$"game"$Chr(9)$"NetMode"$Chr(9)$"SinglePlayer"); else StatLog.LogEventString(StatLog.GetTimeStamp()$Chr(9)$"game"$Chr(9)$"NetMode"$Chr(9)$"PracticeMatch"); } } //------------------------------------------------------------------------------ // Game Querying. function string GetRules() { local string ResultSet; ResultSet = Super.GetRules(); ResultSet = ResultSet$"\\timelimit\\"$TimeLimit; ResultSet = ResultSet$"\\fraglimit\\"$FragLimit; Resultset = ResultSet$"\\minplayers\\"$MinPlayers; Resultset = ResultSet$"\\changelevels\\"$bChangeLevels; Resultset = ResultSet$"\\tournament\\"$bTournament; if(bMegaSpeed) Resultset = ResultSet$"\\gamestyle\\Turbo"; else if(bHardcoreMode) Resultset = ResultSet$"\\gamestyle\\Hardcore"; else Resultset = ResultSet$"\\gamestyle\\Classic"; if(MinPlayers > 0) Resultset = ResultSet$"\\botskill\\"$class'ChallengeBotInfo'.default.Skills[Difficulty]; return ResultSet; } function InitGameReplicationInfo() { Super.InitGameReplicationInfo(); TournamentGameReplicationInfo(GameReplicationInfo).FragLimit = FragLimit; TournamentGameReplicationInfo(GameReplicationInfo).TimeLimit = TimeLimit; } function bool CheckThisTranslocator(Bot aBot, TranslocatorTarget T) { return false; } function bool OneOnOne() { return ( NumPlayers + NumBots == 2 ); } function float SpawnWait(bot B) { if ( bRatedGame && bNoviceMode && !bTeamGame && (Difficulty <= 2) && (NumBots > 1) && (B.PlayerReplicationInfo.Score > RatedPlayer.PlayerReplicationInfo.Score) ) return ( 7 + NumBots * FRand() ); return ( NumBots * FRand() ); } function bool NeverStakeOut(bot Other) { return false; } defaultproperties { AirControl=0.350000 TimeLimit=15 bChangeLevels=True bHardCoreMode=True bMultiWeaponStay=True NetWait=10 RestartWait=15 CountDown=10 TourneyMessage="Waiting for other players." WaitingMessage1="Waiting for ready signals." WaitingMessage2="(Use your fire button to toggle ready!)" ReadyMessage="You are READY!" NotReadyMessage="You are NOT READY!" CountDownMessage=" seconds until play starts!" StartMessage="The match has begun!" GameEndedMessage="wins the match!" SingleWaitingMessage="Press Fire to start." gamegoal="frags wins the match." InitialBots=11 NoNameChange=" is already in use." OvertimeMessage="Score tied at the end of regulation. Sudden Death Overtime!!!" BotConfigType=Class'Botpack.ChallengeBotInfo' LadderTypeIndex=1 bRestartLevel=False bPauseable=False bDeathMatch=True ScoreBoardType=Class'Botpack.TournamentScoreBoard' BotMenuType="UTMenu.UTBotConfigSClient" RulesMenuType="UTMenu.UTRulesSClient" SettingsMenuType="UTMenu.UTSettingsSClient" GameUMenuType="UTMenu.UTGameMenu" MultiplayerUMenuType="UTMenu.UTMultiplayerMenu" GameOptionsMenuType="UTMenu.UTOptionsMenu" HUDType=Class'Botpack.ChallengeHUD' MapListType=Class'Botpack.TDMmaplist' MapPrefix="DM" BeaconName="DM" GameName="Tournament DeathMatch" DeathMessageClass=Class'Botpack.DeathMessagePlus' DMMessageClass=Class'Botpack.DeathMatchMessage' MutatorClass=Class'Botpack.DMMutator' GameReplicationInfoClass=Class'Botpack.TournamentGameReplicationInfo' bLoggingGame=True } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |