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 |
/** * Copyright 1998-2011 Epic Games, Inc. All Rights Reserved. */ //============================================================================= // UTTeamInfo. // includes list of bots on team for multiplayer games // //============================================================================= class UTTeamInfo extends TeamInfo; var int DesiredTeamSize; var UTTeamAI AI; var UTGameObjective HomeBase; // key objective associated with this team var UTCarriedObject TeamFlag; /** only bot characters in this faction will be used */ var string Faction; var color BaseTeamColor[4]; var localized string TeamColorNames[4]; replication { if (bNetDirty) HomeBase, TeamFlag; } simulated function string GetHumanReadableName() { if ( TeamName == Default.TeamName ) { if ( TeamIndex < 4 ) return TeamColorNames[TeamIndex]; return TeamName@TeamIndex; } return TeamName; } simulated function color GetHUDColor() { return BaseTeamColor[TeamIndex]; } /* Reset() reset actor to initial state - used when restarting level without reloading. */ function Reset() { Super.Reset(); if ( !UTGame(WorldInfo.Game).bTeamScoreRounds ) Score = 0; } function bool AllBotsSpawned() { return false; } /** * Initializes the team index and grabs any associated BotTeamRosters */ function Initialize(int NewTeamIndex) { TeamIndex = NewTeamIndex; } function bool NeedsBotMoreThan(UTTeamInfo T) { return ( (DesiredTeamSize - Size) > (T.DesiredTeamSize - T.Size) ); } function SetBotOrders(UTBot NewBot) { if (AI != None) { AI.SetBotOrders(NewBot); } } function RemoveFromTeam(Controller Other) { Super.RemoveFromTeam(Other); if (AI != None) { AI.RemoveFromTeam(Other); } } function bool BotNameTaken(string BotName) { local int i; local UTPlayerReplicationInfo PRI; local UTGameReplicationInfo GRI; GRI = UTGameReplicationInfo(WorldInfo.GRI); for (i=0;i<GRI.PRIArray.Length;i++) { PRI = UTPlayerReplicationInfo(WorldInfo.GRI.PRIArray[i]); if (PRI.PlayerName == BotName) { return true; } } return false; } function GetAvailableBotList(out array<int> AvailableBots, optional string FactionFilter, optional bool bMalesOnly) { local int i; AvailableBots.length = 0; for (i=0;i<class'UTCharInfo'.default.Characters.length;i++) { if( (FactionFilter == "" || class'UTCharInfo'.default.Characters[i].Faction ~= FactionFilter) && !bMalesOnly && !BotNameTaken(class'UTCharInfo'.default.Characters[i].CharName) ) { AvailableBots[AvailableBots.Length] = i; } } } /** retrieves bot info, for the named bot if a valid name is specified, otherwise from a random bot */ function CharacterInfo GetBotInfo(string BotName) { local int Index; local array<int> AvailableBots; local bool bMalesOnly; // Only allow male chars once game is in progress.. bMalesOnly = WorldInfo.Game.IsInState('MatchInProgress'); Index = class'UTCharInfo'.default.Characters.Find('CharName', BotName); if (Index == INDEX_NONE) { // First attempt to add a bot from the Faction if (Faction != "") { GetAvailableBotList(AvailableBots,Faction,bMalesOnly); if (AvailableBots.Length > 0) { Index = AvailableBots[0]; } } // If we still haven't found a good match, take a bot from any faction if (Index == INDEX_None) { GetAvailableBotList(AvailableBots,,bMalesOnly); if (AvailableBots.Length > 0) { Index = AvailableBots[Rand(AvailableBots.Length)]; } } // If we still haven't found a good match looking for men, take a female if (bMalesOnly && Index == INDEX_None) { GetAvailableBotList(AvailableBots); if (AvailableBots.Length > 0) { Index = AvailableBots[Rand(AvailableBots.Length)]; } } // At this point, if we haven't found a bot, just take any bot if ( Index == INDEX_None ) { Index = Rand(class'UTCharInfo'.default.Characters.length); } } return class'UTCharInfo'.default.Characters[Index]; } simulated event Destroyed() { Super.Destroyed(); if (AI != None) { AI.Destroy(); } } defaultproperties { DesiredTeamSize=8 BaseTeamColor(0)=(r=255,g=64,b=64,a=255) BaseTeamColor(1)=(r=64,g=64,b=255,a=255) BaseTeamColor(2)=(r=65,g=255,b=64,a=255) BaseTeamColor(3)=(r=255,g=255,b=0,a=255) } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |