| Home Page | Recent Changes | Preferences

# 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 beggining 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

## Comments

## Related Topics

Stat Points System/Ammo Pickup Modifier

UnrealScript Lessons

Category Class (UT2003)

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In