Announcement

Collapse
No announcement yet.

How to Make a Bot Invincible/God Mode

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

    How to Make a Bot Invincible/God Mode

    I understand that the player can become invincible via console commands, but how do I do that for bots?

    There's a specific bot I want to make invincible but I couldn't find any help on Google or any mods that would do that.

    Can someone tell me what I have to do? Thanks.

    #2
    Bump. Can someone please help me?

    Comment


      #3
      I think I can give this a go... if I make something that works I'll post it back here.

      Comment


        #4
        Here you go!

        Ok, so in the the interest of having you learn something (yeah!), here is the source code for a mutator that allows you to turn invincibility on and off for a single bot, or all bots using console commands. Take a look at this mutator tutorial for creating a new combo, the only thing you need to pay attention to is the "Getting Started" section, and specifically the Package/Folder tree structure, and then compiling (its much simpler than it looks, UMake makes it really easy once the folder structure is set-up).

        I've tested this code in another one of my mutators, and it works for bots (but I've not compiled this exact script).

        Code:
        //=============================================================================
        // Add mutator console command functionality to turn bot's bGodMode variable to true/false
        // by meowcat
        // example console command "mutate botgod-abaddon" to make Abaddon invincible
        //                                     "mutate botgodoff-abaddon" to turn-off Abaddon invincibility
        //                                     "mutate botgod-all" to make all bots invincible
        //                                     "mutate botgodoff-all" to turn-off invincibility for all bots
        //=============================================================================
        
        class MutBotGod extends Mutator;
        
        function Mutate(string MutateString, PlayerController Sender){
        	local int iLoc;
        	 local string BotName, message;
        	 local controller C;
        	local bool bAffectAllBots, bGodOn;
        
            if(Sender.PlayerReplicationInfo.bAdmin || Level.Netmode==NM_Standalone){
                // first search for "bot invicible" commands
                iLoc = InStr(MutateString, "botgod");
                if(iLoc >=0){
                    Divide(MutateString, "-", message, BotName);
                    if(message ~= "botgod") bGodOn=true; // yeah
                    if(BotName ~= "all") bAffectAllBots = true;
        
                    //log("Bot God Command: message>"@message@", BotName>"@BotName,'MutBotGod');
                    for( C=Level.ControllerList;C!=None;C=C.NextController ){
                        if (Bot(C) != none && (C.GetHumanReadableName()~= BotName || bAffectAllBots)){
                            if(bGodOn) C.bGodMode=true;
                            else C.bGodMode=false;
                        }
                    }
                    Sender.ClientMessage("Mutate>Bot God Command check: message>"@message@", BotName>"@BotName);
                }
            }
        	if ( NextMutator != None )
        		NextMutator.Mutate(mutatestring, sender);
        }
        
        defaultproperties
        {
             GroupName="BotGod"
             FriendlyName="Bot God Mutator"
             Description="Allows invincibility to be turned on/off for each bot by name, or all bots. Use 'mutate botgod-BotsName'  or 'mutate botgodoff-BotsName' to activate/deactivate invincibility for the bot named BotsName (replace with the bot's in game name), or use 'all' to affect all bots.  -by Meowcat"
        }

        You could also make a fancy in-game menu that allowed you to graphically turn the bGodMode property on and off from a list of bots (or even players) but that involves more code than I am willing to work on right now.

        Comment


          #5
          Originally posted by meowcat View Post
          Ok, so in the the interest of having you learn something (yeah!), here is the source code for a mutator that allows you to turn invincibility on and off for a single bot, or all bots using console commands. Take a look at this mutator tutorial for creating a new combo, the only thing you need to pay attention to is the "Getting Started" section, and specifically the Package/Folder tree structure, and then compiling (its much simpler than it looks, UMake makes it really easy once the folder structure is set-up).

          I've tested this code in another one of my mutators, and it works for bots (but I've not compiled this exact script).

          Code:
          //=============================================================================
          // Add mutator console command functionality to turn bot's bGodMode variable to true/false
          // by meowcat
          // example console command "mutate botgod-abaddon" to make Abaddon invincible
          //                                     "mutate botgodoff-abaddon" to turn-off Abaddon invincibility
          //                                     "mutate botgod-all" to make all bots invincible
          //                                     "mutate botgodoff-all" to turn-off invincibility for all bots
          //=============================================================================
          
          class MutBotGod extends Mutator;
          
          function Mutate(string MutateString, PlayerController Sender){
          	local int iLoc;
          	 local string BotName, message;
          	 local controller C;
          	local bool bAffectAllBots, bGodOn;
          
              if(Sender.PlayerReplicationInfo.bAdmin || Level.Netmode==NM_Standalone){
                  // first search for "bot invicible" commands
                  iLoc = InStr(MutateString, "botgod");
                  if(iLoc >=0){
                      Divide(MutateString, "-", message, BotName);
                      if(message ~= "botgod") bGodOn=true; // yeah
                      if(BotName ~= "all") bAffectAllBots = true;
          
                      //log("Bot God Command: message>"@message@", BotName>"@BotName,'MutBotGod');
                      for( C=Level.ControllerList;C!=None;C=C.NextController ){
                          if (Bot(C) != none && (C.GetHumanReadableName()~= BotName || bAffectAllBots)){
                              if(bGodOn) C.bGodMode=true;
                              else C.bGodMode=false;
                          }
                      }
                      Sender.ClientMessage("Mutate>Bot God Command check: message>"@message@", BotName>"@BotName);
                  }
              }
          	if ( NextMutator != None )
          		NextMutator.Mutate(mutatestring, sender);
          }
          
          defaultproperties
          {
               GroupName="BotGod"
               FriendlyName="Bot God Mutator"
               Description="Allows invincibility to be turned on/off for each bot by name, or all bots. Use 'mutate botgod-BotsName'  or 'mutate botgodoff-BotsName' to activate/deactivate invincibility for the bot named BotsName (replace with the bot's in game name), or use 'all' to affect all bots.  -by Meowcat"
          }

          You could also make a fancy in-game menu that allowed you to graphically turn the bGodMode property on and off from a list of bots (or even players) but that involves more code than I am willing to work on right now.
          Okay, I've just tried following all these instructions, but I apparently couldn't get anything to work right.

          Comment


            #6
            Hmm.... Ok give this a try:
            1. Go to your UT2004 root folder (typically C:\UT2004) and create a new folder titled "BotGodMutator", then go into that folder and create another folder titled "classes".
            2. Inside the "classes" folder, create a new text document titled "MutBotGod.txt", and then copy and paste all of the sample code above into that text document, then save it.
            3. Change the text file's file extension from '.txt' to '.uc' (designating it as an UnrealScript file to be compiled, 'MutBotGod.uc').
            4. Open the UT2k4.ini file and find the section titled "[Editor.EditorEngine]".
            5. Add the line "EditPackages=BotGodMutator" after the line "EditPackages=UTV2004s" then save the changes (this will tell UCC.exe to try and compile your new code package when it is run)
            6. Go up one folder into the "BotGodMutator" folder. Create another .txt file and name it something like UCCCompileBatch.txt.
            7. Open " UCCCompileBatch.txt" and paste the following lines (making sure that the first line contains the file path to your UT2004 folder):
            cd C:\UT2004\System
            ucc make


            These lines tell the windows shell to change the working target directory ('cd') to your UT2004\System folder where UCC.exe is located, then to run UCC.exe with the command "make". UCC has a bunch of other commands that also can export stuff etc.

            8. Save the file changes, close the text file, then change the file extension from '.txt' to '.bat' (a batch file, 'UCCCompileBatch.bat'). Windows will probably ask you if you want to do this, go ahead and confirm the change. Now when you doubleclick this batch file UCC.exe will runs and try to rebuild any .u files that it is missing from the System folder (based on the list of "EditPackages=" lines from UT2k4.ini file)

            That should have compiled the mutator as a .u file in your UT2004\System folder. If you want to test your own adjustments to the code, change the contents of the .uc file, delete the BotGodMutator.u file from, the System folder, then rerun the batch file.

            Comment


              #7
              Originally posted by meowcat View Post
              Hmm.... Ok give this a try:
              1. Go to your UT2004 root folder (typically C:\UT2004) and create a new folder titled "BotGodMutator", then go into that folder and create another folder titled "classes".
              2. Inside the "classes" folder, create a new text document titled "MutBotGod.txt", and then copy and paste all of the sample code above into that text document, then save it.
              3. Change the text file's file extension from '.txt' to '.uc' (designating it as an UnrealScript file to be compiled, 'MutBotGod.uc').
              4. Open the UT2k4.ini file and find the section titled "[Editor.EditorEngine]".
              5. Add the line "EditPackages=BotGodMutator" after the line "EditPackages=UTV2004s" then save the changes (this will tell UCC.exe to try and compile your new code package when it is run)
              6. Go up one folder into the "BotGodMutator" folder. Create another .txt file and name it something like UCCCompileBatch.txt.
              7. Open " UCCCompileBatch.txt" and paste the following lines (making sure that the first line contains the file path to your UT2004 folder):
              cd C:\UT2004\System
              ucc make


              These lines tell the windows shell to change the working target directory ('cd') to your UT2004\System folder where UCC.exe is located, then to run UCC.exe with the command "make". UCC has a bunch of other commands that also can export stuff etc.

              8. Save the file changes, close the text file, then change the file extension from '.txt' to '.bat' (a batch file, 'UCCCompileBatch.bat'). Windows will probably ask you if you want to do this, go ahead and confirm the change. Now when you doubleclick this batch file UCC.exe will runs and try to rebuild any .u files that it is missing from the System folder (based on the list of "EditPackages=" lines from UT2k4.ini file)

              That should have compiled the mutator as a .u file in your UT2004\System folder. If you want to test your own adjustments to the code, change the contents of the .uc file, delete the BotGodMutator.u file from, the System folder, then rerun the batch file.
              That was a lot simpler, thanks. But the last step gave me a problem. I got an error message that looked like this:
              https://www.dropbox.com/s/mgofnw11jk...itled.png?dl=0

              Comment


                #8
                Can you post the lines from the .bat file? I think there might be an error there for the file path (right click the .bat file and choose the "Edit" option to open it for editing).

                Comment


                  #9
                  Originally posted by meowcat View Post
                  Can you post the lines from the .bat file? I think there might be an error there for the file path (right click the .bat file and choose the "Edit" option to open it for editing).
                  Here's what my .bat file looks like:

                  https://www.dropbox.com/s/pwqodwhlw3...Batch.png?dl=0

                  Comment


                    #10
                    You forgot to put cd before the path.
                    cd C:\Games\ etc.

                    Comment


                      #11
                      Originally posted by UnShame View Post
                      You forgot to put cd before the path.
                      cd C:\Games\ etc.
                      Thanks for telling me. I managed to create the mod now. Only thing is when testing it, and inputting the bot's name, I had to make the first letter in their name capitalized or else the cheat wouldn't work. I tested it on Harlequin and it worked!

                      Comment


                        #12
                        I forgot to mention this after further testing, but the cheat doesn't protect affected bots from friendly fire from good bots or when they are holding the enemy flag in CTF.

                        Comment


                          #13
                          @ Deadpool69: What other mods are you using, and what gametype are you playing? I specifically had tested it with full friendly fire turned on so I could try and inflict damage to both enemy and same team bots, and it appeared to work perfectly. A cursory search of the UT2k4 Uscript source for key terms (bGodMode, InGodMode, ReduceDamage etc.) and the function call string did not seem to appear to show anything that would keep the bGodMode variable setting from being bypassed.

                          Comment


                            #14
                            Originally posted by meowcat View Post
                            @ Deadpool69: What other mods are you using, and what gametype are you playing? I specifically had tested it with full friendly fire turned on so I could try and inflict damage to both enemy and same team bots, and it appeared to work perfectly. A cursory search of the UT2k4 Uscript source for key terms (bGodMode, InGodMode, ReduceDamage etc.) and the function call string did not seem to appear to show anything that would keep the bGodMode variable setting from being bypassed.
                            I tried playing with no mutators on CTF and TDM, but my bot was still able to die. I don't know why that was happening.

                            Here's an example of what I do: I simply type in "mutate botgod-Harlequin" after I type in all of my other cheats.

                            Comment


                              #15
                              Oh wait. Never mind. I got it to work now. I forgot it was a mutator and that I was supposed to add it in the mutators section, I kinda missed that part. You were right, meowcat. It works fine and there's nothing wrong with it.

                              Comment

                              Working...
                              X