Announcement

Collapse
No announcement yet.

Balance Teams Mutator

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

    Balance Teams Mutator

    I am running a UT2K4 server with assault maps. However, in the map vote feature I have the choice of picking trails maps. But, I need to have balanced teams enabled for the other maps. How would I program a mutator to check if the map name begins with 'as-tr'? And with that disable balanced teams? But, if the map begins with just 'as' to have balanced teams enabled.

    This is what I have and it doesn't work cause I don't know the global variable for players balace teams:

    function PostBeginPlay()
    {
    Local string mapname;
    mapname = Level.Title;

    Super.PostBeginPlay();

    if ( InStr(mapname,Caps("AS-TR")) != -1 )
    {
    Level.bPlayersBalanceTeams () = false;
    }
    else
    {
    Level.bPlayersBalanceTeams () = true;
    }
    }

    I do know bPlayersBalanceTeams is inside UnrealGame.TeamGame, but I don't know how to edit the variable, and if it's possible before the game starts... also this example script extends mutator...

    #2
    For one thing, you don't need the () after bPlayersBalanceTeams. I'd also suggest moving the "mapname=..." line after the Super; that might be part of the problem too.

    Comment


      #3
      Here is an updated version which does compile but doesn't work

      //================================================== ===========================
      // DexTRBalance.
      //================================================== ===========================
      class DexTRBalance extends Mutator;


      function PostBeginPlay()
      {
      Local string mapname;

      Super.PostBeginPlay();
      mapname = Level.Title;

      if ( InStr(mapname,Caps("AS-TR")) != -1 )
      {
      class'TeamGame'.Default.bPlayersBalanceTeams = false;
      }
      else
      {
      class'TeamGame'.Default.bPlayersBalanceTeams = true;
      }
      }

      Comment


        #4
        Also, looks like you're trying to modify the TeamGame class itself, which definitely ain't gonna work... try "Level.Game.bPlayersBalanceTeams".

        Comment


          #5
          C:\UT2004\DexTRBalance\Classes\DexTRBalance.uc(14) : Error, Unrecognized member
          'bPlayersBalanceTeams' in class 'GameInfo'


          when i just try a direct set of:

          //================================================== ===========================
          // DexTRBalance.
          //================================================== ===========================
          class DexTRBalance extends Mutator;


          function PostBeginPlay()
          {
          Local string mapname;

          Super.PostBeginPlay();


          Level.Game.bPlayersBalanceTeams = false;
          }

          Comment


            #6
            Hmm.
            TeamGame(Level.Game).bPlayersBalanceTeams?

            Comment


              #7
              OMG YES!! It worked thank you soooooo much!!! :up: :up: :up:

              Comment

              Working...
              X