Advertisement
Guest User

Untitled

a guest
Jan 6th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MY CODE: SRGameType.uc
  2. Some code here that is irrelevant...
  3. ...
  4. State MatchInProgress
  5. {
  6.  
  7.     function CloseShops()
  8.     {
  9.         local int i;
  10.         local Controller C;
  11.         local Pickup Pickup;
  12.  
  13.         bTradingDoorsOpen = False;
  14.         for( i=0; i<ShopList.Length; i++ )
  15.         {
  16.             if( ShopList[i].bCurrentlyOpen )
  17.                 ShopList[i].CloseShop();
  18.         }
  19.  
  20.         SelectShop();
  21.  
  22.         foreach AllActors(class'Pickup', Pickup)
  23.         {
  24.             if ( Pickup.bDropped )
  25.             {
  26.                 Pickup.Destroy();
  27.             }
  28.         }
  29.  
  30.         // Tell all players to stop showing the path to the trader
  31.         for ( C = Level.ControllerList; C != none; C = C.NextController )
  32.         {
  33.             if ( C.Pawn != none && C.Pawn.Health > 0 )
  34.             {
  35.                 // Restore pawn collision during trader time
  36.                 C.Pawn.bBlockActors = C.Pawn.default.bBlockActors;
  37.  
  38.                 if ( KFPlayerController(C) != none )
  39.                 {
  40.                     KFPlayerController(C).SetShowPathToTrader(false);
  41.                     KFPlayerController(C).ClientForceCollectGarbage();
  42.  
  43.                     if ( WaveNum < FinalWave - 1 )
  44.                     {
  45.                         // Have Trader tell players that the Shop's Closed
  46.                         KFPlayerController(C).ClientLocationalVoiceMessage(C.PlayerReplicationInfo, none, 'TRADER', 6);
  47.                     }
  48.                 }
  49.             }
  50.         }
  51.     }
  52.    
  53.     function BeginState()
  54.     {
  55.         Super.BeginState();
  56.  
  57.         WaveNum = InitialWave;
  58.         InvasionGameReplicationInfo(GameReplicationInfo).WaveNumber = WaveNum;
  59.  
  60.         // Ten second initial countdown
  61.         WaveCountDown = 10;// Modify this if we want to make it take long for zeds to spawn initially
  62.  
  63.         SetupPickups();
  64.     }  
  65.    
  66.     function SetupPickups()
  67.     {
  68.         local int NumWeaponPickups, NumAmmoPickups, Random, i, j;
  69.         local int m;
  70.        
  71.         // Randomize Available Ammo Pickups
  72.         if ( GameDifficulty >= 5.0 ) // Suicidal and Hell on Earth
  73.         {
  74.             NumWeaponPickups = WeaponPickups.Length * 0.25;
  75.             NumAmmoPickups = AmmoPickups.Length * 0.25;
  76.         }
  77.         else if ( GameDifficulty >= 4.0 ) // Hard
  78.         {
  79.             NumWeaponPickups = WeaponPickups.Length * 0.50;
  80.             NumAmmoPickups = AmmoPickups.Length * 0.50;
  81.         }
  82.         else if ( GameDifficulty >= 2.0 ) // Normal
  83.         {
  84.             NumWeaponPickups = WeaponPickups.Length * 0.75;
  85.             NumAmmoPickups = AmmoPickups.Length * 0.75;
  86.         }
  87.         else // Beginner
  88.         {
  89.             NumWeaponPickups = WeaponPickups.Length * 1.00;
  90.             NumAmmoPickups = AmmoPickups.Length * 1.00;
  91.         }
  92.  
  93.         // Always have at least 1 pickup
  94.         NumWeaponPickups = Max(1, NumWeaponPickups);
  95.         NumAmmoPickups = Max(1, NumAmmoPickups);
  96.  
  97.         // reset all the of the pickups
  98.         for ( m = 0; m < WeaponPickups.Length ; m++ )
  99.         {
  100.             if(WeaponPickups[m] != None)
  101.             {
  102.                 WeaponPickups[m].DisableMe();
  103.             }
  104.         }
  105.  
  106.         for ( m = 0; m < AmmoPickups.Length ; m++ )
  107.         {
  108.             if( AmmoPickups[m] != None )
  109.             {
  110.                 AmmoPickups[m].GotoState('Sleeping', 'Begin');
  111.             }
  112.         }
  113.  
  114.         // Ramdomly select which pickups to spawn
  115.         for ( i = 0; i < NumWeaponPickups && j < 10000; i++ )
  116.         {
  117.             Random = Rand(WeaponPickups.Length);
  118.             if(WeaponPickups.Length==0) break;
  119.             if ( WeaponPickups[Random]!=None && !WeaponPickups[Random].bIsEnabledNow )
  120.             {
  121.                 WeaponPickups[Random].EnableMe();
  122.             }
  123.             else
  124.             {
  125.                 i--;
  126.             }
  127.  
  128.             j++;
  129.         }
  130.  
  131.         for ( i = 0; i < NumAmmoPickups && j < 10000; i++ )
  132.         {
  133.             Random = Rand(AmmoPickups.Length);
  134.             if(AmmoPickups.Length==0) break;
  135.             if ( AmmoPickups[Random]!=None && AmmoPickups[Random].bSleeping )
  136.             {
  137.                 AmmoPickups[Random].GotoState('Pickup');
  138.             }
  139.             else
  140.             {
  141.                 i--;
  142.             }
  143.  
  144.             j++;
  145.         }
  146.     }
  147. }
  148.  
  149. ORIGINAL KFMod.KFGameType
  150.     function SetupPickups()
  151.     {
  152.         local int NumWeaponPickups, NumAmmoPickups, Random, i, j;
  153.         local int m;
  154.  
  155.         // Randomize Available Ammo Pickups
  156.         if ( GameDifficulty >= 5.0 ) // Suicidal and Hell on Earth
  157.         {
  158.             NumWeaponPickups = WeaponPickups.Length * 0.1;
  159.             NumAmmoPickups = AmmoPickups.Length * 0.1;
  160.         }
  161.         else if ( GameDifficulty >= 4.0 ) // Hard
  162.         {
  163.             NumWeaponPickups = WeaponPickups.Length * 0.2;
  164.             NumAmmoPickups = AmmoPickups.Length * 0.35;
  165.         }
  166.         else if ( GameDifficulty >= 2.0 ) // Normal
  167.         {
  168.             NumWeaponPickups = WeaponPickups.Length * 0.3;
  169.             NumAmmoPickups = AmmoPickups.Length * 0.5;
  170.         }
  171.         else // Beginner
  172.         {
  173.             NumWeaponPickups = WeaponPickups.Length * 0.5;
  174.             NumAmmoPickups = AmmoPickups.Length * 0.65;
  175.         }
  176.  
  177.         // reset all the of the pickups
  178.         for ( m = 0; m < WeaponPickups.Length ; m++ )
  179.         {
  180.             WeaponPickups[m].DisableMe();
  181.         }
  182.  
  183.         for ( m = 0; m < AmmoPickups.Length ; m++ )
  184.         {
  185.             AmmoPickups[m].GotoState('Sleeping', 'Begin');
  186.         }
  187.  
  188.         // Ramdomly select which pickups to spawn
  189.         for ( i = 0; i < NumWeaponPickups && j < 10000; i++ )
  190.         {
  191.             Random = Rand(WeaponPickups.Length);
  192.  
  193.             if ( !WeaponPickups[Random].bIsEnabledNow )
  194.             {
  195.                 WeaponPickups[Random].EnableMe();
  196.             }
  197.             else
  198.             {
  199.                 i--;
  200.             }
  201.  
  202.             j++;
  203.         }
  204.  
  205.         for ( i = 0; i < NumAmmoPickups && j < 10000; i++ )
  206.         {
  207.             Random = Rand(AmmoPickups.Length);
  208.  
  209.             if ( AmmoPickups[Random].bSleeping )
  210.             {
  211.                 AmmoPickups[Random].GotoState('Pickup');
  212.             }
  213.             else
  214.             {
  215.                 i--;
  216.             }
  217.  
  218.             j++;
  219.         }
  220.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement