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 |
class xDMRoster extends DMRoster DependsOn(xUtil); function Initialize(int TeamBots) { local int i; for ( i=Roster.Length; i<TeamBots; i++ ) AddRandomPlayer(); for ( i=0; i<TeamBots; i++ ) Roster[i].PrecacheRosterFor(self); } function PostBeginPlay() { local array<xUtil.PlayerRecord> PlayerRecords; local int i,j; Super.PostBeginPlay(); // add RosterNames to roster class'xUtil'.static.GetPlayerList(PlayerRecords); for ( i=0; i<RosterNames.Length; i++ ) { j = Roster.Length; Roster.Length = Roster.Length + 1; Roster[j] = class'xRosterEntry'.Static.CreateRosterEntryCharacter(RosterNames[i]); } } function RosterEntry GetRandomPlayer() { local array<xUtil.PlayerRecord> PlayerRecords; local int RND,i, num; local int max, total; class'xUtil'.static.GetPlayerList(PlayerRecords); for ( i=0; i<PlayerRecords.Length; i++ ) max += PlayerRecords[i].BotUse; RND = Rand(Max); for ( i=0; i<PlayerRecords.Length; i++ ) { total += PlayerRecords[i].BotUse; if ( total >= RND ) break; } num = i; if ( AvailableRecord(PlayerRecords[num].Menu) && !AlreadyExistsEntry(PlayerRecords[num].DefaultName,true) ) return class'xRosterEntry'.Static.CreateRosterEntry(num); for ( i=num; i<PlayerRecords.Length; i++ ) if ( AvailableRecord(PlayerRecords[i].Menu) && (PlayerRecords[i].BotUse > 0) && !AlreadyExistsEntry(PlayerRecords[i].DefaultName,true) ) return class'xRosterEntry'.Static.CreateRosterEntry(i); for ( i=0; i<num; i++ ) if ( AvailableRecord(PlayerRecords[i].Menu) && (PlayerRecords[i].BotUse > 0) && !AlreadyExistsEntry(PlayerRecords[i].DefaultName,true) ) return class'xRosterEntry'.Static.CreateRosterEntry(i); return GetNamedBot("Jakob"); } function bool AvailableRecord(string MenuString) { return ( (MenuString ~= "DUP") || (MenuString ~= "SP") || (MenuString ~= "") || (MenuString ~= "UNLOCK") ); } function RosterEntry GetNamedBot(string botName) { local array<xUtil.PlayerRecord> PlayerRecords; local xUtil.PlayerRecord PR; class'xUtil'.static.GetPlayerList(PlayerRecords); PR = class'xUtil'.static.FindPlayerRecord(botName); return class'xRosterEntry'.Static.CreateRosterEntry(PR.RecordIndex); } function bool AlreadyExistsEntry(string CharacterName, bool bNoRecursion) { local int i; for ( i=0; i<Roster.Length; i++ ) if ( (xRosterEntry(Roster[i]) != None) && (xRosterEntry(Roster[i]).PlayerName == CharacterName) ) return true; return false; } function bool BelongsOnTeam(class<Pawn> PawnClass) { return true; } defaultproperties { } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |