Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ====================================================================
- // Class: MiA_Regen.MiA_Regen
- // Description: regenerates all players' health & ammo
- //
- // Written by Rajliv in Feb 2012
- // ====================================================================
- class MiA_Regen extends Mutator config(MiA_Regen);
- var config bool bCrouchHealth,bInfAmmo;
- var config int RegenAmmoInterval,RegenHealthInterval,AmmoModifier,HealthModifier,MaxHealth,MaxAmmoModifier;
- var int TimerIndexH,TimerIndexA;
- function MatchStarting()
- {
- SaveConfig();
- SetTimer(1.0,true);
- }
- function Timer()
- {
- local Controller C;
- local Pawn P;
- local Inventory Inv;
- local Weapon W;
- local bool bHealTime,bAmmoTime;
- if(RegenHealthInterval!=0) {
- if(TimerIndexH!=RegenHealthInterval)
- TimerIndexH+=1;
- else {
- TimerIndexH=1;
- bHealTime=true;
- }
- }
- if(RegenAmmoInterval!=0) {
- if(TimerIndexA!=RegenAmmoInterval)
- TimerIndexA+=1;
- else {
- TimerIndexA=1;
- bAmmoTime=true;
- }
- }
- for (C=Level.ControllerList; C!=None; C=C.NextController) {
- if (C.bIsPlayer && (C.Pawn != None)){
- P = C.Pawn;
- P.HealthMax = MaxHealth;
- if(bHealTime && (P.Health < P.HealthMax)){
- if(!bCrouchHealth || P.bIsCrouched)
- P.Health = Min(P.Health+HealthModifier, P.HealthMax);
- }
- for(Inv=P.Inventory; Inv!=None; Inv=Inv.Inventory) {
- /* if (Ammunition(Inv)!=None) {
- log("Ammunition(Inv)!=None");
- Ammunition(Inv).MaxAmmo = Ammunition(Inv).default.MaxAmmo * MaxAmmoModifier;
- if(bAmmoTime){
- Ammunition(Inv).AmmoAmount += AmmoModifier;
- log("AMMO TIME");
- }
- if(bInfAmmo && Weapon(Inv)!=None) {
- Weapon(Inv).SuperMaxOutAmmo();
- C.AwardAdrenaline(999);
- }
- }*/
- W=Weapon(Inv);
- if(W!=None)
- {
- if(bAmmoTime) {
- W.AddAmmo(AmmoModifier, 0);
- //W.AddAmmo(AmmoModifier, 1);
- }
- /* if(W.Ammo[0]!=None) {
- W.Ammo[0].MaxAmmo = Ammo[0].default.MaxAmmo * MaxAmmoModifier;
- }
- if(W.Ammo[1]!=None) {
- W.Ammo[1].MaxAmmo = Ammo[1].default.MaxAmmo * MaxAmmoModifier;
- if(bAmmoTime)
- W.Ammo[1].AmmoAmount += AmmoModifier;
- }*/
- if(bInfAmmo) {
- Weapon(Inv).SuperMaxOutAmmo();
- C.AwardAdrenaline(999);
- }
- }
- }
- }
- }
- }
- defaultproperties
- {
- bCrouchHealth=false
- bInfAmmo=false
- RegenAmmoInterval=5
- RegenHealthInterval=1
- AmmoModifier=5
- HealthModifier=1
- MaxHealth=110
- MaxAmmoModifier=2
- FriendlyName="MiA_Regen"
- Description="Players' health and ammo regenerate."
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement