[solved] mH2 Max ammo by weapons

Discussions about Coding and Scripting
User avatar
Letylove49
Adept
Posts: 494
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

[solved] mH2 Max ammo by weapons

Post by Letylove49 »

Hi i need help for this please :

i would like to set max ammo for each weapons: ( i have a function who replace standard weapons by Mh2Weapons)
variable:

Code: Select all

var config int EnforcerMaxAmmo;
var config int BiorifleMaxAmmo;
var config int RipperMaxAmmo;
var config int ShockrifleMaxAmmo;
var config int supershockrifleMaxAmmo;
var config int PulseMaxAmmo;
var config int Minigun2MaxAmmo;
var config int FlakCannonMaxAmmo;
var config int EighballMaxAmmo; 
Function :

Code: Select all


if (bUseRegenAmmo)
            {
                    for (Inv = P.Inventory; Inv != None; Inv = Inv.Inventory)
               {
                  if (Ammo(Inv) != None) 
                  {
if ( Ammo(Inv).MaxAmmo > 10 ) Ammo(Inv).AmmoAmount = EnforcerMaxAmmo;
                     if ( Ammo(Inv).MaxAmmo > 10 ) Ammo(Inv).AmmoAmount = BiorifleMaxAmmo;
                     if ( Ammo(Inv).MaxAmmo > 10 ) Ammo(Inv).AmmoAmount = RipperMaxAmmo;
                     if ( Ammo(Inv).MaxAmmo > 10 ) Ammo(Inv).AmmoAmount = ShockrifleMaxAmmo;
                     if ( Ammo(Inv).MaxAmmo > 10 ) Ammo(Inv).AmmoAmount = supershockrifleMaxAmmo;
                     if ( Ammo(Inv).MaxAmmo > 10 ) Ammo(Inv).AmmoAmount = PulseMaxAmmo;
                     if ( Ammo(Inv).MaxAmmo > 10 ) Ammo(Inv).AmmoAmount = Minigun2MaxAmmo;
                     if ( Ammo(Inv).MaxAmmo > 10 ) Ammo(Inv).AmmoAmount = FlakCannonMaxAmmo;
                     if ( Ammo(Inv).MaxAmmo > 10 ) Ammo(Inv).AmmoAmount = EighballMaxAmmo; 
}
}
}

Defaut settings:

Code: Select all

EnforcerMaxAmmo=1990
     BiorifleMaxAmmo=1000
     RipperMaxAmmo=750
     ShockrifleMaxAmmo=500
     supershockrifleMaxAmmo=500
     PulseMaxAmmo=1990
     Minigun2MaxAmmo=1990
     FlakCannonMaxAmmo=500
     EighballMaxAmmo=480

Code: Select all


function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
   if (Other.isA('Weapon') && Other.Instigator != None && Other.Instigator.IsA('ScriptedPawn'))
   {
      return true;
   }
   if(Other.IsA('Pickup'))
   {
      Pickup(Other).bAutoActivate=True;
   }
   if(Other.Class==Class'NaliFruit')
   {
      ReplaceWith(Other,MH2NaliFruit);
      return false;
   }
   if(Other.Class==Class'Bandages')
   {
      ReplaceWith(Other,"MH2GoldCTGv2b.MH2Bandages");
      return false;
   }
   if(Other.Class==Class'Health')
   {
      ReplaceWith(Other,"MH2GoldCTGv2b.MH2U1Health");
      return false;
   }
   if(Other.Class==Class'SuperHealth')
   {
      ReplaceWith(Other,"MH2GoldCTGv2b.MH2SuperHealth");
      return false;
   }
   if(Other.Class==Class'MedBox')
   {
      ReplaceWith(Other,MH2MedBox);
      return false;
   }
   if(Other.Class==Class'HealthPack')
   {
      ReplaceWith(Other,MH2HealthPack);
      return false;
   }
   if(Other.Class==Class'HealthVial')
   {
      ReplaceWith(Other,MH2HealthVial);
      return false;
   }
   if(Other.Class==Class'ShieldBelt')
   {
      ReplaceWith(Other,"MH2GoldCTGv2b.MH2U1ShieldBelt");
      return false;
   }
   if(Other.Class==Class'PowerShield')
   {
      ReplaceWith(Other,"MH2GoldCTGv2b.MH2U1ShieldBelt");
      return false;
   }
   if(Other.Class==Class'UT_ShieldBelt')
   {
      ReplaceWith(Other,"MH2GoldCTGv2b.MH2ShieldBelt");
      return false;
   }
   if(Other.Class==Class'ThighPads')
   {
      ReplaceWith(Other,"MH2GoldCTGv2b.MH2ThighPads");
      return false;
   }
   if(Other.Class==Class'Armor2')
   {
      ReplaceWith(Other,"MH2GoldCTGv2b.MH2Armor2");
      return false;
   }
   if(UseLimeLight)
   {
      if(Other.IsA('Flashlight') && !Other.IsA('LimeLight'))
      {
         ReplaceWith(Other,"MH2GoldCTGv2b.LimeLight");
	 return false;
      }
   }
   if(UseMH2JumpBoots)
   {
      if(Other.IsA('JumpBoots') && !Other.IsA('MH2JumpBoots'))
      {
      	 ReplaceWith(Other,"MH2GoldCTGv2b.MH2JumpBoots");
         return false;
      }
   }
   if(Other.IsA('UT_JumpBoots') && !Other.IsA('MH2JumpBoots'))
   {
      if(InStr ( Level.Title, "Andromeda" ) == -1)  //Stupid hack to let the people play with the everlasting jump boots
      {
         ReplaceWith(Other,"MH2GoldCTGv2b.MH2JumpBoots");
         return false;
      }
   }
   if(ReplaceInvis)
   {
      if(Other.Class==Class'Invisibility')
      {
         ReplaceWith(Other,MH2MedBox);
         return false;
      }
   }
   if(Other.Class==Class'SCUBAgear')
   {
      ReplaceWith(Other,"MH2GoldCTGv2b.MH2Scuba");
      return false;
   }
   if(Other.IsA('Carcass'))
   {
      if(bGhostCarcass)
      {
         Other.Style = STY_Translucent;
            Other.SetCollision(False);
         return True;
      }
   }
   if (Other.Class==Class'BiterFishSchool')
   {
      ReplaceWith(Other,"MH2GoldCTGv2b.MH2BiterFishSchool");
      return False;
   }
   if(Other.Class==Class'QuadShot') //Quad has buggy graphics
   {
      ReplaceWith(Other,"MH2GoldCTGv2b.MH2FlakCannon");
      return false;
   }
   if(Use2k4Deemer)
   {
      if(Other.Class==Class'WarHeadLauncher')
      {
         ReplaceWith(Other,"MH2GoldCTGv2b.MH2WarheadLauncher");
         return false;
      }
   }


 if(UseMH2Enforcer)
   {
      if(Other.Class==Class'Enforcer')
      {
         ReplaceWith(Other,"MH2GoldCTGv2b.MH2Enforcer");
         return false;
      }
   }
   
   
     if(UseMH2BioRifle)
   {
      if(Other.Class==Class'UT_BioRifle')
      {
         ReplaceWith(Other,"MH2GoldCTGv2b.MH2Biorifle");
         return false;
      }
   }
   
   
   if(UseMH2ShockRifle)
   {
      if(Other.Class==Class'ShockRifle')
      {
         ReplaceWith(Other,"MH2GoldCTGv2b.MH2ShockRifle");
         return false;
      }
   }
   
   
   if(UseMH2SupershockRifle)
   {
      if(Other.Class==Class'SuperShockRifle')
      {
         ReplaceWith(Other,"MH2GoldCTGv2b.MH2SuperShockRifle");
         return false;
      }
   }
   
      if(UseMH2PulseGun)
   {
      if(Other.Class==Class'PulseGun')
      {
         ReplaceWith(Other,"MH2GoldCTGv2b.MH2PulseGun");
         return false;
      }
   }
   
      if(UseMH2Ripper)
   {
      if(Other.Class==Class'Ripper')
      {
         ReplaceWith(Other,"MH2GoldCTGv2b.MH2Ripper");
         return false;
      }
   }
   
         if(UseMH2Minigun2)
   {
      if(Other.Class==Class'Minigun2')
      {
         ReplaceWith(Other,"MH2GoldCTGv2b.MH2Minigun2");
         return false;
      }
   }

      
      if(UseMH2FlakCannon)
   {
      if(Other.Class==Class'UT_FlakCannon')
      {
         ReplaceWith(Other,"MH2GoldCTGv2b.MH2FlakCannon'");
         return false;
      }
   }
      
      if(UseMH2Eightball)
   {
      if(Other.Class==Class'UT_Eightball')
      {
         ReplaceWith(Other,"MH2GoldCTGv2b.MH2Eightball");
         return false;
      }
      
   }
Image
Image
Letylove49 aka Alicia
User avatar
Letylove49
Adept
Posts: 494
Joined: Tue Feb 28, 2012 7:47 pm
Personal rank: AK admin
Location: suisse

Re: [solved] mH2 Max ammo by weapons

Post by Letylove49 »

i have creat a custum class for each weapons. Thanks Barbie
Image
Image
Letylove49 aka Alicia