| Home Page | Recent Changes | Preferences

# Ammo (UT)

UT :: Actor (UT) >> Inventory (UT) >> Pickup (UT) >> Ammo (Package: Engine)

Parent class of ammunition types for Weapon (UT)s. Child class TournamentAmmo corresponds with TournamentWeapon (UT) weapons.

One does not actually posess a quantity of Ammo inventory items. Rather, an Ammo item is a placeholder which indicates how much of the corresponding ammunition type the player may expend.

## Properties

int AmmoAmount (travel, replicated to owning client)
  In inventory, the amount of ammunition of this type the player may expend. For a pickup, amount of ammunition to be added to an inventory copy of the ammotype's AmmoAmount.
int MaxAmmo (travel)
  Maximum amount AmmoAmount may reach in a player's inventory.
class<Ammo> ParentAmmo
  Parent class of Ammotype. Some ammotypes are smaller, child classes of other types, only different in, say, the size of AmmoAmount. Providing a link to a parent class prevents the child ammo from being added to a player's inventory separately from its parent.
byte UsedInWeaponSlot[10]
  For display purposes AFAIK. Position in the HUD Ammo and AmmoAmount should be displayed in.
Ammo PAmmo
  ???Original implementation of ParentAmmo???

## Methods

### Inherited from Inventory (UT)

float BotDesireability (Pawn (UT) Bot)

## Known subclasses

- ASMDAmmo
- FlakBox
- NullAmmo?
- RazorAmmo?
- RifleAmmo
- RocketCan?
- ShellBox
- Shells?
- Sludge?
- StingerAmmo?
- TournamentAmmo

Category Class (UT)

Csimbi: How can I change the starting ammo, the maximum ammo, and the pickup ammo settings dynamically (default properties are static)?

The following code adjust starting ammo and maximum ammo correctly, but how can I adjust the amount of ammo that is added when player picks up some ammo?

    function GiveWeapon(pawn P, string ThisClass)
    {
        local class<weapon> WeaponClass;
        local weapon NewWeapon;

        if (ThisClass=="none") return;

        WeaponClass = class<weapon>(DynamicLoadObject(ThisClass, class'Class') );
        if (WeaponClass==none||P.FindInventoryType(WeaponClass)!=none) return;

        WeaponClass.default.ItemArticle=MyArticle;
        NewWeapon=Spawn(WeaponClass);
        WeaponClass.default.ItemArticle=NormalArticle;
        NewWeapon.RespawnTime=0.0;
        NewWeapon.GiveTo(P);
        NewWeapon.bHeldItem=true;
        NewWeapon.GiveAmmo(P);
        NewWeapon.SetSwitchPriority(P);
        NewWeapon.WeaponSet(P);
        NewWeapon.AmbientGlow = 0;

        if (P.IsA('PlayerPawn')) NewWeapon.SetHand(PlayerPawn(P).Handedness);
        else NewWeapon.GotoState('Idle');
        P.Weapon.GotoState('DownWeapon');
        P.PendingWeapon=none;
        if(ThisClass==MyWeapon && NewWeapon!=none)
        {
            NewWeapon.AmmoType.AmmoAmount=class'OptionsPage'.default.InitialAmmo;
            NewWeapon.AmmoType.MaxAmmo=class'OptionsPage'.default.MaxAmmo;
        }
    }

An example would be nice... Thank You.

Wormbo: You can use one of the various HandlePickupQuery() functions (Inventory (UT), Mutator (UT), etc.) to handle any type of pickup, but could you please put your questions where people can actually find them? The Help Desk would be a good place, or a coding forum (e.g. [BUF Coding]).

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