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 |
// ==================================================================== // Class: BonusPack.xLastManStandingGame // // Main 'Last Man Standing' game type tab. // // Written by James Golding // (c) 2002, Epic Games, Inc. All Rights Reserved // ==================================================================== class xLastManStandingGame extends xDeathMatch config; struct LMSDataEntry { var PlayerController PC; var vector LocationHistory[10]; var int NextLocHistSlot; var bool bWarmedUp; var int ReWarnTime; }; var array<LMSDataEntry> LMSData; var config float CampThreshold; var config int ReCamperWarnInterval; var config bool bHealthForKill; // number of kills before you get an extra life (zero indicates never give extra life) var config bool bAllowSuperweapons; var config bool bCamperAlarm; var config bool bAllowPickups; var config bool bAllowAdrenaline; var config bool bFullAmmo; const LMSPROPNUM = 8; var localized string LMSPropsDisplayText[LMSPROPNUM]; var localized string LMSPropDescText[LMSPROPNUM]; // When player starts - give them all the weapons (not super weapons)! function AddGameSpecificInventory(Pawn p) { local Inventory Inv; Super.AddGameSpecificInventory(p); p.CreateInventory("XWeapons.BioRifle"); p.CreateInventory("XWeapons.FlakCannon"); p.CreateInventory("XWeapons.LinkGun"); p.CreateInventory("XWeapons.Minigun"); p.CreateInventory("XWeapons.RocketLauncher"); p.CreateInventory("XWeapons.ShockRifle"); p.CreateInventory("XWeapons.SniperRifle"); if ( bFullAmmo ) { For ( Inv=P.Inventory; Inv!=None; Inv=Inv.Inventory ) { if ( Weapon(Inv) != None ) Weapon(Inv).MaxOutAmmo(); } } } // Make sure all weapons are loaded. static function PrecacheGameTextures(LevelInfo myLevel) { Super.PrecacheGameTextures(myLevel); class'XWeapons.BioRiflePickup'.static.StaticPrecache(myLevel); class'XWeapons.FlakCannonPickup'.static.StaticPrecache(myLevel); class'XWeapons.LinkGunPickup'.static.StaticPrecache(myLevel); class'XWeapons.MinigunPickup'.static.StaticPrecache(myLevel); class'XWeapons.RocketLauncherPickup'.static.StaticPrecache(myLevel); class'XWeapons.ShockRiflePickup'.static.StaticPrecache(myLevel); class'XWeapons.SniperRiflePickup'.static.StaticPrecache(myLevel); } static function PrecacheGameAnnouncements(AnnouncerVoice V, bool bRewardSounds) { Super.PrecacheGameAnnouncements(V,bRewardSounds); if ( !bRewardSounds ) V.PrecacheSound('Camper'); } /* OBSOLETE UpdateAnnouncements() - preload all announcer phrases used by this actor */ simulated function UpdateAnnouncements() {} // Parse options for this game... event InitGame( string Options, out string Error ) { local string InOpt; Super.InitGame(Options, Error); // Should we allow superweapons InOpt = ParseOption( Options, "SuperWeaps"); if(InOpt != "") bAllowSuperweapons=bool(InOpt); // Use camper alarm InOpt = ParseOption( Options, "CamperAlarm"); if(InOpt != "") bCamperAlarm=bool(InOpt); InOpt = ParseOption(Options, "AllowPickups"); if (InOpt !="") bAllowPickups=bool(InOpt); InOpt = ParseOption(Options, "AllowAdrenaline"); if (InOpt !="") bAllowAdrenaline=bool(InOpt); InOpt = ParseOption(Options, "HealthForKill"); if (InOpt !="") bHealthForKill=bool(InOpt); GoalScore=0; // Force no Frag Limit } // Used to award extra lives for kills function NotifyKilled(Controller Killer, Controller Other, Pawn OtherPawn) { Super.NotifyKilled(Killer, Other, OtherPawn); // If we are not doing extra-life bonus' if(!bHealthForKill || Killer==None || Killer.Pawn == None || Killer.Pawn.Health >100) return; Killer.Pawn.Health = Killer.Pawn.HealthMax; } // Send camper warning function SendCamperWarning(PlayerController Camper) { local Controller P; local PlayerController Player; for(P = Level.ControllerList; P != None; P = P.nextController) { Player = PlayerController(P); if (Player != None) { // No one camps in the first 45 seconds if (Level.TimeSeconds - Player.PlayerReplicationInfo.StartTime < 45) return; if(Player == Camper) Player.ReceiveLocalizedMessage(class'BonusPack.LMSMessage', 0); else Player.ReceiveLocalizedMessage(class'BonusPack.LMSMessage', 1, Camper.PlayerReplicationInfo); } } } // Camper-detector State MatchInProgress { // GameInfo's already have a 1 second timer... function Timer() { local int i,j; local Box HistoryBox; local float MaxDim; local bool bSentWarning; Super.Timer(); // Do nothing else if camper alarm is off. if(!bCamperAlarm) return; i=0; while(i < LMSData.Length && !bSentWarning) { //Log( "Checking: "$LMSData[i].PC.PlayerReplicationInfo.PlayerName ); // If controller has expired (eg. left the game), remove the guard. if( LMSData[i].PC == None ) { //Log("Expiring Camper Guard."); LMSData.Remove(i, 1); } else if( !LMSData[i].PC.PlayerReplicationinfo.bIsSpectator && !LMSData[i].PC.PlayerReplicationinfo.bOnlySpectator && LMSData[i].PC.PlayerReplicationInfo.NumLives<MaxLives ) // Spectators can't camp { // Always update LMSData[i].LocationHistory[LMSData[i].NextLocHistSlot] = LMSData[i].PC.Pawn.Location; LMSData[i].NextLocHistSlot++; if(LMSData[i].NextLocHistSlot == 10) { LMSData[i].NextLocHistSlot = 0; LMSData[i].bWarmedUp = true; } // If our history is full, work out how much player is moving about (find max AABB dimension). if(LMSData[i].bWarmedUp) { HistoryBox.Min.X = LMSData[i].LocationHistory[0].X; HistoryBox.Min.Y = LMSData[i].LocationHistory[0].Y; HistoryBox.Min.Z = LMSData[i].LocationHistory[0].Z; HistoryBox.Max.X = LMSData[i].LocationHistory[0].X; HistoryBox.Max.Y = LMSData[i].LocationHistory[0].Y; HistoryBox.Max.Z = LMSData[i].LocationHistory[0].Z; for(j=1; j<10; j++) { HistoryBox.Min.X = FMin( HistoryBox.Min.X , LMSData[i].LocationHistory[j].X ); HistoryBox.Min.Y = FMin( HistoryBox.Min.Y , LMSData[i].LocationHistory[j].Y ); HistoryBox.Min.Z = FMin( HistoryBox.Min.Z , LMSData[i].LocationHistory[j].Z ); HistoryBox.Max.X = FMax( HistoryBox.Max.X , LMSData[i].LocationHistory[j].X ); HistoryBox.Max.Y = FMax( HistoryBox.Max.Y , LMSData[i].LocationHistory[j].Y ); HistoryBox.Max.Z = FMax( HistoryBox.Max.Z , LMSData[i].LocationHistory[j].Z ); } // Find maximum dimension of box MaxDim = FMax(FMax(HistoryBox.Max.X - HistoryBox.Min.X, HistoryBox.Max.Y - HistoryBox.Min.Y), HistoryBox.Max.Z - HistoryBox.Min.Z); //Log("Box: "$HistoryBox.Max.X@HistoryBox.Max.Y@HistoryBox.Max.Z@HistoryBox.Min.X@HistoryBox.Min.Y@HistoryBox.Min.Z); //Log("Player: "$LMSData[i].PC.PlayerReplicationInfo.PlayerName$" MaxDim:"$MaxDim); // Dont warn the same person every second! if(MaxDim < CampThreshold && LMSData[i].ReWarnTime == 0) { //Log(LMSData[i].PC.PlayerReplicationInfo.PlayerName$" IS CAMPING! "$MaxDim); SendCamperWarning(LMSData[i].PC); LMSData[i].ReWarnTime = ReCamperWarnInterval; bSentWarning=true; } else if(LMSData[i].ReWarnTime > 0) LMSData[i].ReWarnTime--; } i++; } else i++; } } } event PostLogin( PlayerController NewPlayer ) { local LMSDataEntry NewData; local int i, l; Super.PostLogin(NewPlayer); NewPlayer.bAdrenalineEnabled = bAllowAdrenaline; // Check we dont already have data for this player controller. for(i=0; i<LMSData.Length; i++) { if( LMSData[i].PC == NewPlayer ) { Log("xLastManStandingGame: Already have LMSData for a PC"); return; } } // Add new data entry for this actor. NewData.PC = NewPlayer; l = LMSData.Length + 1; LMSData.Length = l; LMSData[l-1] = NewData; } function Logout(Controller Exiting) { super.Logout(Exiting); CheckMaxLives(none); } function Bot SpawnBot(optional string botName) { local Bot b; b = Super.SpawnBot(botName); if (B!=None) b.bAdrenalineEnabled = bAllowAdrenaline; return b; } function bool CanSpectate( PlayerController Viewer, bool bOnlySpectator, actor ViewTarget ) { if ( (ViewTarget == None) ) return false; if ( Controller(ViewTarget) != None ) { if ( Controller(ViewTarget).Pawn == None ) return false; return ( (Controller(ViewTarget).PlayerReplicationInfo != None) && (ViewTarget != Viewer) && (!Controller(ViewTarget).PlayerReplicationInfo.bOutOfLives) ); } return ( (Pawn(ViewTarget) != None) && Pawn(ViewTarget).IsPlayerPawn() && (!Pawn(ViewTarget).PlayerReplicationInfo.bOutOfLives) ); } function bool CheckMaxLives(PlayerReplicationInfo Scorer) { local Controller C; local PlayerReplicationInfo PRI,Winner; if ( MaxLives > 0 ) { for ( C=Level.ControllerList; C!=None; C=C.NextController ) { PRI = C.PlayerReplicationInfo; if ( (PRI!=None) && !PRI.bOnlySpectator && !PRI.bOutOfLives ) { if ( Winner!=None ) return false; else Winner = PRI; } } if (Winner==None) EndGame(Scorer,"LastMan"); else EndGame(Winner,"LastMan"); return true; } return false; } function GetServerDetails(out ServerResponseLine ServerState) { Super.GetServerDetails(ServerState); AddServerDetail( ServerState, "CampThreshold", CampThreshold ); AddServerDetail( ServerState, "CamperRewarnInterval", RecamperWarnInterval ); AddServerDetail( ServerState, "HealthForKills", bHealthForKill); AddServerDetail( ServerState, "AllowSuperWeapons", bAllowSuperWeapons ); AddServerDetail( ServerState, "CamperAlarm", bCamperAlarm ); AddServerDetail( ServerState, "AllowPickups", bAllowPickups ); AddServerDetail( ServerState, "AllowAdrenaline", bAllowAdrenaline ); AddServerDetail( ServerState, "FullAmmo", bFullAmmo); } static event bool AcceptPlayInfoProperty(string PropertyName) { if ( !Default.bCamperAlarm ) { if ( InStr(PropertyName, "CampThreshold") != -1 ) return false; if ( InStr(PropertyName, "ReCamperWarnInterval") != -1 ) return false; } if ( PropertyName == "MaxLives" ) return true; if ( PropertyName == "bWeaponStay" ) return false; return Super.AcceptPlayInfoProperty(PropertyName); } static function FillPlayInfo(PlayInfo PI) { Super.FillPlayInfo(PI); PI.AddSetting(default.RulesGroup, "bHealthForKill", GetDisplayText("bHealthForKill"), 40, 1, "Check", ,, ,True); PI.AddSetting(default.RulesGroup, "bAllowSuperweapons", GetDisplayText("bAllowSuperweapons"), 40, 1, "Check", ,, ,True); PI.AddSetting(default.RulesGroup, "bAllowPickups", GetDisplayText("bAllowPickups"), 60, 1, "Check", ,, ,True); PI.AddSetting(default.RulesGroup, "bAllowAdrenaline", GetDisplayText("bAllowAdrenaline"), 50, 1, "Check", ,, ,True); PI.AddSetting(default.RulesGroup, "bFullAmmo", GetDisplayText("bFullAmmo"), 50, 1, "Check", ,, ,True); PI.AddSetting(default.RulesGroup, "bCamperAlarm", GetDisplayText("bCamperAlarm"), 60, 1, "Check", ,, True,True); PI.AddSetting(default.GameGroup, "CampThreshold", GetDisplayText("CampThreshold"), 60, 1, "Check", ,, True,True); PI.AddSetting(default.GameGroup, "ReCamperWarnInterval", GetDisplayText("ReCamperWarnInterval"), 60, 1, "Text", "2;0:99",, True,True); } static function string GetDisplayText(string PropName) { switch (PropName) { case "CampThreshold": return default.LMSPropsDisplayText[0]; case "ReCamperWarnInterval": return default.LMSPropsDisplayText[1]; case "bHealthForKill": return default.LMSPropsDisplayText[2]; case "bAllowSuperweapons": return default.LMSPropsDisplayText[3]; case "bCamperAlarm": return default.LMSPropsDisplayText[4]; case "bAllowPickups": return default.LMSPropsDisplayText[5]; case "bAllowAdrenaline": return default.LMSPropsDisplayText[6]; case "bFullAmmo": return default.LMSPropsDisplayText[7]; } return Super.GetDisplayText(PropName); } static event string GetDescriptionText(string PropName) { switch (PropName) { case "CampThreshold": return default.LMSPropDescText[0]; case "ReCamperWarnInterval": return default.LMSPropDescText[1]; case "bHealthForKill": return default.LMSPropDescText[2]; case "bAllowSuperweapons": return default.LMSPropDescText[3]; case "bCamperAlarm": return default.LMSPropDescText[4]; case "bAllowPickups": return default.LMSPropDescText[5]; case "bAllowAdrenaline": return default.LMSPropDescText[6]; case "bFullAmmo": return default.LMSPropDescText[7]; } return Super.GetDescriptionText(PropName); } defaultproperties { CampThreshold=600.000000 ReCamperWarnInterval=10 bHealthForKill=True bAllowSuperweapons=True bCamperAlarm=True bAllowPickups=True bAllowAdrenaline=True LMSPropsDisplayText(0)="Camping Threshold" LMSPropsDisplayText(1)="Camper Warning Interval" LMSPropsDisplayText(2)="Gain Health For Kills" LMSPropsDisplayText(3)="Allow SuperWeapons" LMSPropsDisplayText(4)="Camper Alarm" LMSPropsDisplayText(5)="Allow Pickups" LMSPropsDisplayText(6)="Allow Adrenaline" LMSPropsDisplayText(7)="Full Ammo" LMSPropDescText(0)="Determines how long a player can stand in one spot before triggering a camper warning." LMSPropDescText(1)="Specifies how often the camper warning is played" LMSPropDescText(2)="If this option is enabled, a player gains health after killing another player." LMSPropDescText(3)="If checked, super weapons are included in the player load out." LMSPropDescText(4)="Enable this option to cause an alarm to be played if a player stands in one spot too long." LMSPropDescText(5)="If checked, pickups will be available in the map." LMSPropDescText(6)="If checked, adrenaline combos will be enabled." LMSPropDescText(7)="If checked, players start with max ammo for all weapons." DefaultMaxLives=3 bWeaponStay=False ScoreBoardType="BonusPack.ScoreBoardLMS" HUDType="BonusPack.HudLMS" MapListType="BonusPack.MapListLastManStanding" GoalScore=0 MaxLives=20 TimeLimit=0 MutatorClass="BonusPack.MutLastManStanding" BroadcastHandlerClass="BonusPack.LMSBroadcastHandler" GameName="Last Man Standing" Description="Each player starts with a limited number of lives. The goal is to be the last player left when the smoke clears." ScreenShotName="UT2004Thumbnails.LMSShots" DecoTextName="BonusPack.LastManStandingGame" Acronym="LMS" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |