Legacy:Inventory - Unreal Wiki

# Legacy:Inventory

### From Unreal Wiki, The Unreal Engine Documentation Site

UT2003 :: Actor >> Inventory (Package: Engine)

Inventory is the abstract parent class of all actors that can be carried by Pawns. In rough terms, this is things carried by players: weapons, ammo, and so on. But Inventory classes are also used for things that aren't visible: for instance, when a player has special ability (some sort of power-up) this can be represented by them carrying a piece of inventory which is responsible for making changes to the player (such as adding a visual effect or changing the HUD or changing the player's properties).

Each inventory class knows what pickup can spawn it (its PickupClass). When tossed out (using the DropFrom() function), inventory items replace themselves with an actor of their Pickup class.

All of a Pawn's Inventory actors are in a linked list which uses the Actor -> Inventory property. Inventory is automatically destroyed when the actor carrying in is destroyed, or the player carrying it dies.

## Properties

### Main

bool bDrawingFirstPerson
  Determines if we're in 1st person.
float BobDamping
  How much to damp view bob.
IntBox IconCoords
  Coordinates of icon in IconMaterial.
Material IconMaterial
  Where icon is located.
string ItemName
  Localized name of item.

### Firstperson

vector PlayerViewOffset
  Offset from view center.
rotator PlayerViewPivot
  Additive rotation offset for tweaks.

### Hidden

class<InventoryAttachment> AttachmentClass
bool bDisplayableInv
  Determines whether the item should be displayed in the HUD.
bool bTossedOut
  True if weapon or inventory was tossed out (so players can't cheat w/ weaponstay)
byte GroupOffset
  Position within inventory group. (used by prevweapon and nextweapon)
class<Pickup> PickupClass
  What class of pickup is associated with this inventory item
Actor ThirdPersonActor
  Mesh to use in 3rd person view.

## Functions

AttachToPawn( Pawn P )
  Attach inventory item to pawn.
updaterelative( int pitch, int yaw, int roll ) (exec)
  For tweaking weapon positioning. Pass in a new relativerotation, and use the weapon editactor properties sheet to modify the relativelocation
DetachFromPawn( Pawn P )
  Detach inventory item from pawn.
string GetHumanReadableName() (simulated)
  Returns the name of the object.
PickupFunction( Pawn Other)
  Function called when the item is picked up.
Weapon RecommendWeapon( out float rating ) (simulated)
  Rate the inventory item as a weapon.
TravelPostAccept()
Destroyed()
  Called when the inventory item is to be destroyed for release of resources, etc.
GiveTo( Pawn Other, optional Pickup Pickup )
  Give inventory item to another pawn.
bool HandlePickupQuery( Pickup Item )
  Determines whether or not the item can be picked up based on other items in the pawn's inventory.
Powerups SelectNext()
  Select next inventory (powerup) item.
DropFrom( vector StartLocation )
  Drop inventory item.
Use( float Value )
  Use inventory item.
Weapon WeaponChange( byte F, bool bSilent ) (simulated)
  Find a weapon in inventory that has an Inventory Group matching F.
Weapon PrevWeapon( Weapon CurrentChoice, Weapon CurrentWeapon ) (simulated)
  Choose previous weapon.
Weapon NextWeapon( Weapon CurrentChoice, Weapon CurrentWeapon ) (simulated)
  Choose next weapon.
Armor PrioritizeArmor( int Damage, class<DamageType> DamageType, vector HitLocation )
  Return the best armor to use.
OwnerEvent( name EventName )
  Used to inform inventory when owner event occurs (for example jumping or weapon change).
SetOwnerDisplay()
  Used to ask inventory if it needs to affect its owners display properties.
string StaticItemName() (static)
  Returns item name.

## Events

RenderOverlays( Canvas Canvas ) (simulated)
  Render inventory icon, if necessary. Most inventory items are not rendered, except weapons.
TravelPreAccept()
  Called after a travelling inventory item has been accepted into a level. Unknown: Anyone want to elaborate?

## Known Subclasses

    Inventory
     +- Ammunition >>
     +- KeyInventory
     +- Powerups
     |   +- Armor
     +- Weapon >>

## Related Topics

- Pickup

## Discussion

Tarquin: When a player dies, all Inventory actors he holds are destroyed. Any way to prevent this – either have them dropped, or have them remain owned in the player's inventory?

Recondite I'd look in MutUDamageReward and UDamageRules for dropping them, don't know about the other being that easy.

SuperApe: Marked up functions and events. Added Category tags, related topics and subclass tree.

Eliot: Fixed category class ther both was UT2003 :/.

Categories: Legacy Class (UT2003) | Legacy Class (UT2004) | Legacy Class Tree

##### Views

- Legacy
- Discussion
- Current revision

##### Search