Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

All humans on one team. Uneven teams mutator.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    All humans on one team. Uneven teams mutator.

    My hope was to create a mututor that group online human players all on the read team during tdm/ctf/etc play, just like in campaign. But I am getting lost in the code. Is there a easy way around this?

    Got this from Rattlesnake, but it override the number of bots i had set in the options screen. So was 1 vs 1 when I started the game.
    Code:
    function InitMutator(..)
    {
        local UTGame G;
        G = UTGame(WorldInfo.Game);
        if (G != none)
        {
            G.bPlayersVsBots = true;
            G.bCustomBots= true;
        }
    }
    I want to create a mut that adds bots to the blue team automatically. Ex 8 vs 16 in a ctf game or really any team based game. In reality to use the "Card" based system already in game but during the non campaign gametypes. Ie using the 'IronGuard' card in a mutator to add 2 (config) specific bots to the opposing team.

    Code:
    	if ( GameModifierCard == 'IronGuard' )
    	{
    		if ( Profile.HasPersistentKey( class'UTGameModifierCard'.static.GetAltKey(GameModifierCard)) )
    		{
    			i = CardCharacters.Length;
    			CardCharacters.Length = i + 2;
    
    			CardCharacters[i] = "Lauren";
    			j = Rand(IronGuardEnhancedPool.Length);
    			CardCharacters[i+1] = IronGuardEnhancedPool[j];
    		}
    		else
    		{
    			i = CardCharacters.Length;
    			CardCharacters.Length = i + 2;
    			for (j=0;j<2;j++)
    			{
    				r = Rand(IronGuardPool.Length);
    				CardCharacters[i+j] = IronGuardPool[r];
    				IronGuardPool.Remove(r,1);
    			}
    		}
    	}

    #2
    Did I forget to answer a PM? Was buys.

    I did not check the code properly when I gave the first advice. PlayerVsBots as a limit of 16 players. So it can only be Xvs16 (X=real player count). Maybe bCustomBots has not to be set.

    However, here is one very basic mutator which just swaps the Bot to the enemy team.
    Code:
    class VsBotsMutator extends UTMutator;
    
    function NotifyLogin(Controller NewPlayer)
    {
        local TeamInfo NewTeam;
        super.NotifyLogin(NewPlayer);
    
        if (AIController(NewPlayer) != none && WorldInfo.Game.bTeamGame &&
            WorldInfo.GRI.Teams.Length > 1 && UTTeamGame(WorldInfo.Game) != none) 
        {
            NewTeam = WorldInfo.GRI.Teams[1];
    
            // If the bot is already on that team is check inside SetTeam
            UTTeamGame(WorldInfo.Game).SetTeam(NewPlayer, NewTeam, false);
        }
    }

    Comment


      #3
      Got an error compiling:
      Error, Type mismatch in Call to 'SetTeam', parameter 2

      16 players, u mean 16 human players? i thought there was an option/code out there to make it 32. Anyways, I believe even if there is a limit of human players there should not be a limit to bot players. what is the intention of the mut, just too add more bots to the opposite team (or to your team).

      Comment


        #4
        Originally posted by euchreplayer23 View Post
        Got an error compiling:
        Error, Type mismatch in Call to 'SetTeam', parameter 2
        Instead of ...
        Code:
        UTTeamGame(WorldInfo.Game).SetTeam(NewPlayer, NewTeam, false);
        ... write:
        Code:
        UTTeamGame(WorldInfo.Game).SetTeam(NewPlayer, UTTeamInfo(NewTeam), false);
        Originally posted by euchreplayer23 View Post
        16 players, u mean 16 human players? i thought there was an option/code out there to make it 32. Anyways, I believe even if there is a limit of human players there should not be a limit to bot players.
        16 is the maximum of automated players if you set the PlayerVsBots flag as NeedPlayers checks for ...
        Code:
        else if ( bPlayersVsBots )
        {
            return (NumBots < Min(16, BotRatio * NumPlayers));
        }
        ... and return the minimum. If you want to player against more than 16 bot players, you'll need to manually add bots (when having the bPlayersVsBots flag set).


        Originally posted by euchreplayer23 View Post
        what is the intention of the mut, just too add more bots to the opposite team (or to your team).
        The mutator in your first post will just set the flag. If you add a bot like "addbot 1", it will add it to the opponent team.

        The 2nd mutator will just add every joined bot to the opponent team. If you set the var "NumPlay" of your starting line (or in the menu) to 32, it will spawn 31 bots in the opponent team.

        Comment


          #5
          Originally posted by RattleSN4K3 View Post
          Code:
          UTTeamGame(WorldInfo.Game).SetTeam(NewPlayer, UTTeamInfo(NewTeam), false);
          This compiled, loaded into teamgame (started). Text on screen saying bots are now on blue (lauren on blue, etc). But the message is repeated over and over, with out stopping. Pressing start to start actual games crashes ut3.


          Originally posted by RattleSN4K3 View Post
          Code:
          The mutator in your first post will just set the flag. If you add a bot like "addbot 1", it will add it to the opponent team.
          In my first post? g.baddbot = 1
          Code:
          function InitMutator(..)
          {
              local UTGame G;
              G = UTGame(WorldInfo.Game);
              if (G != none)
              {
                  G.bPlayersVsBots = true;
                  G.bCustomBots= true;
              }
          }

          Comment


            #6
            Havn't tried it for myself. I was just assuming that it would work. Strange that it repeats printing the message over and over again.

            What's your general approach? By selecting mutator for a game, you will play it and only human players can join red and bots will be in blue team. How do you add bots?

            Comment


              #7
              The message repeats and repeats. Even though on the player screen the bots on on the blue team already. The message will keep appearing lauren on blue, reaper on blue, lauren on blue, reaper on blue, lauren on blue, reaper on blue. Press fire to start match, crash ut3. I think you would have to diable which ever feature balances teams out in the first place. I think your mutator is doing its process then UT3 tries to balance out and then your mut try to fix and then it repeats the cycle over and over.

              1st mutator:
              My approach was if you were play a 4on4 online Team game, euch23 on read team. That when/if someone (rattle) else human joined that match, they would be on the same team. So Red(euch23, rattle + 2 bots) vs blue(4 bots). I don't want all bots to be on one team just the humans on 1 team just like in campaign when you join some other human match you go on their team.

              2nd mutator:
              Have above mutator working but add more bots to blue team. so red (euch23, rattle, whomever, bot) vs blue(4 bots) + 4 extra bots (from mutator). again just like in "campaign" where in some levels you are out numbered (war-torlan leviathan) 4 players vs 8 bots.

              Originally posted by RattleSN4K3 View Post
              Havn't tried it for myself. I was just assuming that it would work. Strange that it repeats printing the message over and over again.
              What's your general approach? By selecting mutator for a game, you will play it and only human players can join red and bots will be in blue team. How do you add bots?

              Comment


                #8
                You could just use the console command "AddBlueBots"?!

                Comment


                  #9
                  I wanted a mut for simplicity sake. Where anyone could use it easily. I don't use console commands myself at all (Cheating). I appreciate the help though. thank you for trying to help.

                  Comment


                    #10
                    Yes, that's right. Adding a mutator is more comfortable than knowing commands etc. What about this...

                    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;
                                }
                            }
                        }
                    }
                    PS: Console commands are not cheats. Addbots is a legit command, same as switchlevel, etc.

                    Comment


                      #11
                      Well that did switch all bots to blue and did not crash. But the AI is now messed up. Bots in CTF/Greed don't leave the flagstand and WAR they move a little but eventually just stand where they spawn. They still attack when you are close by but nothing else. Do not pick up skulls or flags.

                      I don't use console commands myself, are they all listed some where?

                      Comment


                        #12
                        Hmm. Not sure about that. Looks like the AI has the wrong objective.


                        UDK/UT3's console commands:
                        http://udn.epicgames.com/Three/ConsoleCommands.html

                        Basic admin commands for UT3:
                        http://wiki.unrealadmin.org/FAQ:UT3

                        Comment


                          #13
                          Okay i found this code here as per your suggestion, but how do I get lets say 2 more blue bots with the proper AI?

                          Code:
                          exec function AddBlueBots(int Num)
                          {
                          	// Disable auto balancing of bot teams.
                          	bCustomBots=true;
                          
                          	DesiredPlayerCount = Clamp(DesiredPlayerCount+Num, 1, 32);
                          	while ( (NumPlayers + NumBots < DesiredPlayerCount) && AddBot(,true,1) != none )
                          	{
                          		`log("added blue bot");
                          	}
                          }

                          Comment


                            #14
                            What do you mean? If you call that function with the desired player count (as Num) you will get bots with a proper AI.

                            "2 more bots"
                            Do you want to add 2 bots for each real player?

                            Comment


                              #15
                              I am just trying to get 2 or 3 or 4 more blue bots, in a simple code with working AI. I thought AddBlueBots(int Num) would do that(?)

                              The AI as I have right now doesn't work.
                              Do you want to add 2 bots for each real player?
                              yes, or just in general. Example, playing 8vs10 in warfare, someone join my team (human) the blue team would then get 2 extra bots. So 8vs14.

                              I am compiling like crazy and really just getting lost.

                              Comment

                              Working...
                              X