Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2012
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ====================================================================
  2. //  Class: MiA_Regen.MiA_Regen
  3. //  Description: regenerates all players' health & ammo
  4. //
  5. //  Written by Rajliv in Feb 2012
  6. // ====================================================================
  7. class MiA_Regen extends Mutator config(MiA_Regen);
  8.  
  9. var config bool bCrouchHealth,bInfAmmo;
  10. var config int RegenAmmoInterval,RegenHealthInterval,AmmoModifier,HealthModifier,MaxHealth,MaxAmmoModifier;
  11.  
  12. var int TimerIndexH,TimerIndexA;
  13.  
  14. function MatchStarting()
  15. {
  16.   SaveConfig();
  17.   SetTimer(1.0,true);
  18. }
  19.  
  20. function Timer()
  21. {
  22.   local Controller C;
  23.   local Pawn P;
  24.   local Inventory Inv;
  25.   local Weapon W;
  26.  
  27.   local bool bHealTime,bAmmoTime;
  28.  
  29.   if(RegenHealthInterval!=0) {
  30.     if(TimerIndexH!=RegenHealthInterval)
  31.       TimerIndexH+=1;
  32.     else {
  33.       TimerIndexH=1;
  34.       bHealTime=true;
  35.     }
  36.   }
  37.   if(RegenAmmoInterval!=0) {
  38.     if(TimerIndexA!=RegenAmmoInterval)
  39.       TimerIndexA+=1;
  40.     else {
  41.       TimerIndexA=1;
  42.       bAmmoTime=true;
  43.     }
  44.   }
  45.  
  46.   for (C=Level.ControllerList; C!=None; C=C.NextController) {
  47.  
  48.     if (C.bIsPlayer && (C.Pawn != None)){
  49.       P = C.Pawn;
  50.       P.HealthMax = MaxHealth;
  51.       if(bHealTime && (P.Health < P.HealthMax)){
  52.         if(!bCrouchHealth || P.bIsCrouched)
  53.           P.Health = Min(P.Health+HealthModifier, P.HealthMax);
  54.       }
  55.  
  56.       for(Inv=P.Inventory; Inv!=None; Inv=Inv.Inventory) {
  57. /*        if (Ammunition(Inv)!=None) {
  58.           log("Ammunition(Inv)!=None");
  59.           Ammunition(Inv).MaxAmmo = Ammunition(Inv).default.MaxAmmo * MaxAmmoModifier;
  60.           if(bAmmoTime){
  61.             Ammunition(Inv).AmmoAmount += AmmoModifier;
  62.             log("AMMO TIME");
  63.           }
  64.         if(bInfAmmo && Weapon(Inv)!=None) {
  65.           Weapon(Inv).SuperMaxOutAmmo();
  66.           C.AwardAdrenaline(999);
  67.         }
  68.         }*/
  69.         W=Weapon(Inv);
  70.         if(W!=None)
  71.         {
  72.           if(bAmmoTime) {
  73.             W.AddAmmo(AmmoModifier, 0);
  74.             //W.AddAmmo(AmmoModifier, 1);
  75.           }
  76. /*          if(W.Ammo[0]!=None) {
  77.             W.Ammo[0].MaxAmmo = Ammo[0].default.MaxAmmo * MaxAmmoModifier;
  78.           }
  79.           if(W.Ammo[1]!=None) {
  80.             W.Ammo[1].MaxAmmo = Ammo[1].default.MaxAmmo * MaxAmmoModifier;
  81.             if(bAmmoTime)
  82.               W.Ammo[1].AmmoAmount += AmmoModifier;
  83.           }*/
  84.           if(bInfAmmo) {
  85.             Weapon(Inv).SuperMaxOutAmmo();
  86.             C.AwardAdrenaline(999);
  87.           }
  88.         }
  89.       }
  90.     }
  91.  
  92.   }
  93.  
  94. }
  95.  
  96. defaultproperties
  97. {
  98.   bCrouchHealth=false
  99.   bInfAmmo=false
  100.   RegenAmmoInterval=5
  101.   RegenHealthInterval=1
  102.   AmmoModifier=5
  103.   HealthModifier=1
  104.   MaxHealth=110
  105.   MaxAmmoModifier=2
  106.   FriendlyName="MiA_Regen"
  107.   Description="Players' health and ammo regenerate."
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement