Stat Points System/Ammo Modifier
This tutorial explains how to modify the amount of ammo you can have in your inventory at one time. We will be using the minigun ammo code, but this example can be used with any ammo type
You need to change the name first (so you don't overwrite anything)
class SPSMinigunAmmo extends Ammunition
Now we must add a variable to the beginning of the MinigunAmmo.uc. So, add this to the MinigunAmmo file:
var() float StatPoints //This is the variable for the Stat points
Now, we will change a few lines of code. The original code looks like this:
defaultproperties { MaxAmmo=350 InitialAmount=150 PickupClass=Class'XWeapons.MinigunAmmoPickup' IconMaterial=Texture'InterfaceContent.HUD.SkinA' IconCoords=(X1=445,Y1=75,X2=544,Y2=149) ItemName="Bullets" }
But we need it to look like this:
simulated function PostBeginPlay() { Super.PostBeginPlay(); ModeTick(var dt) { if (StatPoints > 0) //Says if StatPoints is greater than zero... MaxAmmo = MaxAmmo + StatPoints; //Your maximum ammo gets 1 point greater for each point you put into it. else //If StatPoints is 0, then... MaxAmmo = 350; //MaxAmmo is the normal amount } } defaultproperties { MaxAmmo=350 //The Maximum ammo allowed for this class InitialAmount=150 //Starting amount of ammo when you pick up the minigun PickupClass=Class'XWeapons.MinigunAmmoPickup' //The pickup class IconMaterial=Texture'InterfaceContent.HUD.SkinA' IconCoords=(X1=445,Y1=75,X2=544,Y2=149) ItemName="Bullets" //Name of the pickup }
Add the appropriate code and viola! You have a Ammo Amount Modifier based on a stat point system
Any corrections are much appreciated