Domination scoring system question

Discussions about Coding and Scripting

Domination scoring system question

Postby UT Sniper (SJA94) » Wed Apr 03, 2019 1:18 pm

For my NUTStats match replay system for domination games, I want to update player and team scores every second depending on what points are currently captured and by who, and not update every 6 or so seconds the stats are saved to the servers log.

The stupid question i'm going to ask is that if I am reading the code for the domination score system correct, more specifically how long the updates happen? I have never really played much domination, and was surprised to see that the point system changes depending on how much time is left, if there is a time limit for that game.

I read it as this:

If there is no time limit a player/team gets 0.2 points, per point, every second.

If there is a time limit and there is less than 25% of the remaining time left and more than 10% time left, a player/team gets 0.4 points per point every second.

If there is a time limit and there is less than 10% of the time remaining a player/team gets 0.8 points per point every second.


Code in question:
Code: Select all
function Timer()
{
   local NavigationPoint N;
   local ControlPoint CP;
   local int i;
   local float c;
   local PlayerReplicationInfo PRI;

   if ( !bGameEnded )
   {
      c = 0.2;
      if ( TimeLimit > 0 )
      {
         if ( RemainingTime < 0.25 * TimeLimit )
         {
            if ( RemainingTime < 0.1 * TimeLimit )
               c = 0.8;
            else
               c = 0.4;
         }
      }

      if ( !bRequireReady || (CountDown <= 0) )
         for ( N=Level.NavigationPointList; N!=None; N=N.nextNavigationPoint )
         {
            CP = ControlPoint(N);
            if ( (CP != None) && (CP.ControllingTeam != None) && CP.bScoreReady )
            {
               CP.ControllingTeam.Score += c;
               CP.Controller.PlayerReplicationInfo.Score += c;
            }
         }
      DomScoreEvent++;
      if (DomScoreEvent >= 5)
      {
         DomScoreEvent = 0;
         for (i=0; i<4; i++)
         {
            if (Teams[i].Score > 0)
            {
               if (Level.Game.WorldLog != None)
                  Level.Game.WorldLog.LogSpecialEvent("dom_score_update", i, Teams[i].Score);
               if (Level.Game.LocalLog != None)
                  Level.Game.LocalLog.LogSpecialEvent("dom_score_update", i, Teams[i].Score);
            }
         }
         for (i=0; i<32; i++)
         {
            PRI = GameReplicationInfo.PRIArray[i];
            if (PRI != None)
            {
               if (Level.Game.WorldLog != None)
                  Level.Game.WorldLog.LogSpecialEvent("dom_playerscore_update", PRI.PlayerID, int(PRI.Score));
               if (Level.Game.LocalLog != None)
                  Level.Game.LocalLog.LogSpecialEvent("dom_playerscore_update", PRI.PlayerID, int(PRI.Score));            
            }
         }
      }
      if ( GoalTeamScore > 0 )
         for ( i=0; i<4; i++ )
            if ( Teams[i].Score >= GoalTeamScore )
               EndGame("teamscorelimit");
   }
   Super.Timer();
}
Find the Latest player inis https://ooper.000webhostapp.com/ut/newinis/ (2019 version)
My latest UT themed game Spawn Killer 4 Game
User avatar
UT Sniper (SJA94)
Adept
 
Posts: 435
Joined: Thu Jun 24, 2010 10:35 pm
Location: England
Personal rank: noob programmer

Return to Coding, Scripting

Who is online

Users browsing this forum: No registered users and 4 guests