Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Donate
Collapse

Plutonium

  1. Home
  2. BO2 Modding Support & Discussion
  3. REQ: BO2 mod for scorelimit

REQ: BO2 mod for scorelimit

Scheduled Pinned Locked Moved BO2 Modding Support & Discussion
7 Posts 3 Posters 170 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • TacTicToeundefined Offline
    TacTicToeundefined Offline
    TacTicToe
    wrote on last edited by
    #1

    Not sure if this is allowed, but guess I will find out soon enough.

    Can anyone that is fmiliar with creating BO2 mods make a mod that allows the scorelimit/timelimit to adjust based on number of players on the server?

    I would like something like 2-6 players = 10 min / 75 scorelimit
    7-12 players = 15 min / 125 scorelimit
    13+ = 20 min / 175 scorelimit

    So it will scale up or down according to how many are on the server. Hope that makes sense.

    Players complain that when the server is full the rounds end too quickly. I would like the server to be able to auto scale based on server population.

    There is something similar to this on my CoD4 server with OpenWarfare mod, where the number of players changes the map rotation so fewer players uses smaller maps and as the server fills the map rotation changs to larger maps and eliminates the smaller maps. Same sort of concept.

    Anyone?

    Kalitosundefined 1 Reply Last reply
    0
    • Kalitosundefined Offline
      Kalitosundefined Offline
      Kalitos
      replied to TacTicToe on last edited by
      #2

      TacTicToe You could do it the same way you describe for rotation. Based on how many players there are at the end of a match, define in the rotation which "cfg" to use for the next match.

      1 Reply Last reply
      0
      • Resxtundefined Offline
        Resxtundefined Offline
        Resxt Plutonium Staff
        wrote on last edited by Resxt
        #3

        I have something that can help you on my Github: https://github.com/Resxt/Plutonium-IW5-Scripts/blob/main/custom_killstreaks_rewards/automatic_weapons_rewards.gsc

        Take a look at the kills_limit and time_limit variables and the SetLimits() function
        If you want to change the limits based on player count when the game starts, in Init() you'd add a check for player count

        Init()
        {
            kills_limit = 60;
        
            if (level.players.size <= 6)
            {
                kills_limit = 80;
            }
            else if (level.players.size > 6 && level.players.size <= 12)
            {
                kills_limit = 120;
            }
        
            SetLimits(kills_limit);
        }
        

        Or instead of using the SetLimits() function you can load a different cfg as Kalitos said, this is probably easier

        1 Reply Last reply
        1
        • TacTicToeundefined Offline
          TacTicToeundefined Offline
          TacTicToe
          wrote on last edited by
          #4
          #include maps\mp\_utility;
          #include common_scripts\utility;
          #include maps\mp\gametypes\_hud_util;
          
          
          Init()
          {
              kills_limit = 60;
          	time_limit = 10;
          
              if (level.players.size <= 6)
              {
                  kills_limit = 80;
          		time_limit = 10;
              }
              else if (level.players.size > 6 && level.players.size <= 12)
              {
                  kills_limit = 125;
          		time_limit = 15;
              }
              else if (level.players.size > 13)
              {
                  kills_limit = 175;
          		time_limit = 20;
              }
              SetLimits(kills_limit,time_limit);
          }
          
          SetLimits(kills_limit, time_limit)
          {
          	score_multiplier = 0;
          
              SetDvar("scr_" + level.gameType + "_scorelimit", kills_limit * score_multiplier);
          	SetDvar("scorelimit", kills_limit * score_multiplier);
          
          	if (time_limit != undefined)
          	{
          		SetDvar("scr_" + level.gameType + "_timelimit", time_limit);
          		SetDvar("timelimit", time_limit);
          	}
          }
          

          Gives me an error:

          ******* script runtime error *******
          pair '10' and 'undefined' has unmatching types 'integer' and 'undefined'

              at function "setlimits" in file "scripts/kills_limit.gsc"
              at function "init" in file "scripts/kills_limit.gsc"
          

          ******* script runtime error *******
          cannot cast undefined to bool in a control statement

              at function "setlimits" in file "scripts/kills_limit.gsc"
              at function "init" in file "scripts/kills_limit.gsc"
          

          Sorry. Im not too good at GSC scripting. PHP and Python, much better. I can follow along with alot of this, but this error did not make sense.

          Resxtundefined 1 Reply Last reply
          0
          • Resxtundefined Offline
            Resxtundefined Offline
            Resxt Plutonium Staff
            replied to TacTicToe on last edited by Resxt
            #5

            TacTicToe it's not a problem on your side, some of my scripts have warnings that I didn't fix yet.
            I have those too on my server but it works fine. Did you try it?

            Changing if (time_limit != undefined) by if (IsDefined(time_limit)) should remove the warning

            Note that level.players also gets bots on the servers so if you wanna remove them from the players count you'll need a check for bots.

            1 Reply Last reply
            0
            • TacTicToeundefined Offline
              TacTicToeundefined Offline
              TacTicToe
              wrote on last edited by
              #6

              Resxt said in REQ: BO2 mod for scorelimit:

              if (IsDefined(time_limit))

              Worked flawlessly on IW5, thank you.

              Not so much on BO2. 😕

              Resxtundefined 1 Reply Last reply
              0
              • Resxtundefined Offline
                Resxtundefined Offline
                Resxt Plutonium Staff
                replied to TacTicToe on last edited by
                #7

                TacTicToe Yeah this was to give you a rough idea, some functions might be different. As for BO2 I wouldn't know how to do that but it should be similar

                1 Reply Last reply
                0

                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Donate