I love the smell of UnrealEd crashing in the morning. – tarquin

UE3:UTInventoryManager (UT3)

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
UT3 Object >> Actor >> InventoryManager >> UTInventoryManager
Package: 
UTGame
This class in other games:
UDK

UTInventoryManager UT inventory definition

Copyright 1998-2008 Epic Games, Inc. All Rights Reserved.

Properties

AmmoStorage

Type: array<AmmoStore>

Stores the currently stored up ammo

bInfiniteAmmo

Type: bool

if true, all weapons use no ammo

LastAdjustWeaponTime

Type: float

last time AdjustWeapon() was called

PendingSwitchWeapon

Type: UTWeapon

weapon server is retrying switch to because the current weapon temporarily denied it (due to currently firing, etc)

PreviousWeapon

Type: Weapon

Holds the last weapon used

Default values

Property Value
bMustHoldWeapon True

Structs

AmmoStore

Modifiers: native

This struct defines ammo that is stored in inventory, but for which the pawn doesn't yet have a weapon for.

int Amount 
class<UTWeapon> WeaponClass 

Functions

Events

DiscardInventory

simulated event DiscardInventory ()

Overrides: InventoryManager.DiscardInventory

Discard full inventory, generally because the owner died

Other instance functions

AddAmmoToWeapon

function AddAmmoToWeapon (int AmountToAdd, class<UTWeaponWeaponClassToAddTo)

Called by the UTAmmoPickup classes, this function attempts to add ammo to a weapon. If that weapon exists, it adds it otherwise it tracks the ammo in an array for later.

AddInventory

simulated function bool AddInventory (Inventory NewItem, optional bool bDoNotActivate)

Overrides: InventoryManager.AddInventory

Handle AutoSwitching to a weapon

AdjustWeapon

simulated function AdjustWeapon (int NewOffset)


AllAmmo

function AllAmmo (optional bool bAmmoForSuperWeapons)

AllAmmo() All weapons currently in inventory have ammo increased to max allowed value. Super weapons will only have their ammo amount changed if bAmmoForSuperWeapons is true.

ChangedWeapon

simulated function ChangedWeapon ()

Overrides: InventoryManager.ChangedWeapon

Store the last used weapon for later

CheckSwitchTo

simulated function CheckSwitchTo (UTWeapon NewWeapon)

checks if we should autoswitch to this weapon (server)

ClientSetCurrentWeapon

reliable client function ClientSetCurrentWeapon (Weapon DesiredWeapon)

Accessor for the server to begin a weapon switch on the client.

Parameters:

  • DesiredWeapon - The Weapon to switch to

ClientWeaponSet

simulated function ClientWeaponSet (Weapon NewWeapon, bool bOptionalSet)

Overrides: InventoryManager.ClientWeaponSet

Weapon just given to a player, check if player should switch to this weapon Network: LocalPlayer Called from Weapon.ClientWeaponSet()

CreateInventory

simulated function Inventory CreateInventory (class<InventoryNewInventoryItemClass, optional bool bDoNotActivate)

Overrides: InventoryManager.CreateInventory

(Description copied from InventoryManager.CreateInventory)
Spawns a new Inventory actor of NewInventoryItemClass type, and adds it to the Inventory Manager.

Parameters:

  • NewInventoryItemClass - Class of inventory item to spawn and add.

Returns:

Inventory actor, None if couldn't be spawned.

DemoSetCurrentWeapon

reliable demorecording function DemoSetCurrentWeapon (Weapon DesiredWeapon)

Routes weapon switch events to demos

DisruptInventory

function bool DisruptInventory ()


DrawHud

simulated function DrawHud (HUD H)

Overrides: InventoryManager.DrawHud

(Description copied from InventoryManager.DrawHud)
Hook called from HUD actor. Gives access to HUD and Canvas

Parameters:

  • H - HUD

ForceDeployableSwitch

function ForceDeployableSwitch ()

force switch to deployable after getting out of vehicle.

(In case didn't switch for some reason before getting in vehicle)

GetWeaponList

simulated function GetWeaponList (out array<UTWeaponWeaponList, optional bool bFilter, optional int GroupFilter, optional bool bNoEmpty)


HasInventoryOfClass

function Inventory HasInventoryOfClass (class<InventoryInvClass)

Scans the inventory looking for any of type InvClass. If it finds it it returns it, other it returns none.

NeedsAmmo

function bool NeedsAmmo (class<UTWeaponTestWeapon)


NextWeapon

simulated function NextWeapon ()

Overrides: InventoryManager.NextWeapon

Switches to Next weapon Network: Client

PrevWeapon

simulated function PrevWeapon ()

Overrides: InventoryManager.PrevWeapon

Switches to Previous weapon Network: Client

ProcessRetrySwitch

simulated function ProcessRetrySwitch ()

timer function set by RetrySwitchTo() to actually retry the switch

RemoveFromInventory

simulated function RemoveFromInventory (Inventory ItemToRemove)

Overrides: InventoryManager.RemoveFromInventory

(Description copied from InventoryManager.RemoveFromInventory)
Attempts to remove an item from the inventory list if it exists.

Parameters:

  • Item - Item to remove from inventory

RetrySwitchTo

simulated function RetrySwitchTo (UTWeapon NewWeapon)

called to retry switching to the passed in weapon a little later

ServerSetCurrentWeapon

reliable server function ServerSetCurrentWeapon (Weapon DesiredWeapon)

Overrides: InventoryManager.ServerSetCurrentWeapon

When a client-switch begins on a remote-client, the server needs to be told to start the process as well. SetCurrentWeapon() makes that call.

NETWORK - This function should *ONLY* be called from a remote client's SetCurrentWeapon() function.

Parameters:

  • DesiredWeapon - The Weapon to switch to

SetCurrentWeapon

reliable client function SetCurrentWeapon (Weapon DesiredWeapon)

Overrides: InventoryManager.SetCurrentWeapon

SetCurrentWeapon starts a weapon change. It calls SetPendingWeapon and then if it's called on a remote client, tells the server to begin the process.

Parameters:

  • DesiredWeapon - The Weapon to switch to

SetPendingWeapon

simulated function SetPendingWeapon (Weapon DesiredWeapon)

Overrides: InventoryManager.SetPendingWeapon

This is the work-horse of the weapon switch. It will set a new pending weapon and tell the weapon to begin the switch. If the call to Weapon.TryPutdown() returns false, it means that the weapon can't switch at the moment and has deferred it until later

Parameters:

  • DesiredWeapon - The Weapon to switch to

SwitchToBestWeapon

simulated function SwitchToBestWeapon (optional bool bForceADifferentWeapon)

Overrides: InventoryManager.SwitchToBestWeapon

Cut and pasted here except call ClientWeaponSet on the weapon instead of forcing it. This causes all of the "should I put down" logic to occur

SwitchToPreviousWeapon

simulated function SwitchToPreviousWeapon ()


SwitchWeapon

simulated function SwitchWeapon (byte NewGroup)

Handling switching to a weapon group