You could use NotifyLogin and NotifyLogout to add/remove bots automatically.
Announcement
Collapse
No announcement yet.
All humans on one team. Uneven teams mutator.
Collapse
X
-
2 bots per 1 player? Or just 2 bots total? Are you asking for a complete working code? This might needs several playtests (as seen in the previous code which broke the AI code). However - as suggested - you can start with the Notify functions and add/remove bots when a player connects:
Code:function InitMutator(string Options, out string ErrorMessage) { super.InitMutator(Options, ErrorMessage); if (UTGame(WorldInfo.Game) != none) { UTGame(WorldInfo.Game).DesiredPlayerCount = 0; // remove the desired bot count on start UTGame(WorldInfo.Game).bPlayersVsBots = true; // disabling autobalance in TeamGames } } function NotifyLogin(Controller NewPlayer) { local UTGame G; super.NotifyLogin(NewPlayer); G = UTGame(WorldInfo.Game); if (G != none && PlayerController(NewPlayer) != none) { // add 2 bots to blue team G.AddBot("", true, 1); G.AddBot("", true, 1); } } function NotifyLogout(Controller Exiting) { local UTGame G; local UTBot B; local array<UTBot> Bs; local int i; super.NotifyLogout(Exiting); G = UTGame(WorldInfo.Game); if (G != none && PlayerController(Exiting) != none) { // remove 2 random bots foreach WorldInfo.AllControllers(class'UTBot', B) { Bs.AddItem(B); } if (Bs.Length > 0) { i = Rand(Bs.Length); G.KillBot(Bs[i]); Bs.Remove(i, 1); } if (Bs.Length > 0) { i = Rand(Bs.Length); G.KillBot(Bs[i]); Bs.Remove(i, 1); } } }
Comment
-
It did not work as intended. What I wanted was selecting 8 total players in the select screen. Then adding a mutator that adds 2 blue bots, so the end result would be 4 red (1human 3bots) vs 6 blue (6 bots or 8 etc...).
I tried adding more, it didn't work the notify login stuff I can add much later. Always 1 vs 2 a sit is now.
G.AddBot("", true, 1);
G.AddBot("", true, 1);
G.AddBot("", true, 1);
G.AddBot("", true, 1);
Thank you for the help.
Comment
-
"4 red (1human 3bots)" bots in the same team as humans?
It sounds like all you want is what BotRatio is doing.
Code:var float BotRatio; function InitMutator(string Options, out string ErrorMessage) { local UTGame G; super.InitMutator(Options, ErrorMessage); G = UTGame(WorldInfo.Game); if (G == none) return; G.BotRatio = BotRatio; G.bPlayersVsBots = (G.BotRatio > 0); } defaultproperties { BotRatio=1.5 }
Comment
-
I want a mutator that can add more bots to the opposite/bot team. So I can have a 4 (bots or players) red team vs a 8 bot blue team. No console commands.
In a dream situation, I would like all humans on the same team vs all bots on the blue team. TKBS mentioned above your post that this was done somewhere b4(?) ex. Red(2 players + 2 bots) vs Blue (4 or more bots).
Did nothing.
Code:function InitMutator(string Options, out string ErrorMessage) { local UTGame G; super.InitMutator(Options, ErrorMessage); G = UTGame(WorldInfo.Game); if (G == none) return; G.BotRatio = BotRatio; G.bPlayersVsBots = (G.BotRatio > 0); } defaultproperties { BotRatio=1.5 }
Code:class VsBotsMutator extends UTMutator; function InitMutator(string Options, out string ErrorMessage) { local UTTeamGame G; super.InitMutator(Options, ErrorMessage); G = UTTeamGame(WorldInfo.Game); if (G != none) { // We need to force red team to be filled // in order to bypass team balancing with bots G.bForceAllRed = true; G.bCustomBots = true; } } function bool AllowChangeTeam(Controller Other, out int num, bool bNewTeam) { if (AIController(Other) != none) num = 1; else num = 0; return super.AllowChangeTeam(Other, num, bNewTeam); } function NotifyLogin(Controller NewPlayer) { local TeamInfo NewTeam; local int ForceTeamIndex; local UTBot B; super.NotifyLogin(NewPlayer); if (WorldInfo.Game.bTeamGame && WorldInfo.GRI.Teams.Length > 1 && UTTeamGame(WorldInfo.Game) != none) { ForceTeamIndex = INDEX_NONE; if (AIController(NewPlayer) != none) ForceTeamIndex = 1; else if (PlayerController(NewPlayer) != none) ForceTeamIndex = 0; if (ForceTeamIndex != INDEX_NONE && NewPlayer.PlayerReplicationInfo != none && NewPlayer.PlayerReplicationInfo.Team != none && NewPlayer.PlayerReplicationInfo.Team.TeamIndex != ForceTeamIndex) { NewTeam = WorldInfo.GRI.Teams[ForceTeamIndex]; UTTeamGame(WorldInfo.Game).SetTeam(NewPlayer, UTTeamInfo(NewTeam), true); } // manually fix balancing bots as we forced red if (ForceTeamIndex == 0) { foreach WorldInfo.AllControllers(class'UTBot', B) { if (WorldInfo.Game.NumBots + WorldInfo.Game.NumPlayers > UTGame(WorldInfo.Game).DesiredPlayerCount) { B.Destroy(); } break; } } } }
Comment
-
Okay. Going to try something new from scratch. Also, have you been testing MapMixer (the mutator for instance)? The menu allows to setup such games.
Let me summarize:
- Possible to have uneven teams
- Preferable player on 1 side bots on the other
- For every player there should be X bots
Such list must be very simple and not in conflict (which some of your statements are; not clear enough). It is hard to guess what you really want.
Comment
-
Mapmixer? I will find it and check it out.
- Possible to have uneven teams, YES
- Preferable player on 1 side bots on the other, YES but I want some bots on my team.
- For every player there should be X bots, not necessarily. Would be cool though.
See attached pic from the campaign mode of UT3. I just want to do the below with a mutator in any GT i select in the menu screen (CTF or WAR etc). Just 2 or more extra blue bots.
Comment
Comment