Pickups, Drops and Holders

Documentation Unreal Engine Player Combat Items Interaction

An item lying in the world is a world item, picked up with Interact. Dropping turns what is in hand back into one, and a rack, an item holder, holds items in named places to take and put back.


Set it up

4 minutes
  1. 1

    Let the sword lie in the world

    Add a World Item fragment to Item_MySword from the Items quick start. It draws a mesh only with a Visuals fragment too.
  2. 2

    Place it in the level

    Place a BP_UPC_WorldItem in LVL_UPC_Demo with Item Definition Item_MySword. If the Items quick start put Item_MySword in BP_UPC_Character's Starting Items, remove it so the character starts without the sword.
  3. 3

    Pick it up

    Press Play, look at the sword and press E: it goes into the inventory, onto belt slot 1 and into the hand.
  4. 4

    Drop it

    Press G, the demo's drop key: the sword drops to the ground.

Items lying in the world

A world item (BP_UPC_WorldItem) holds an item, a count and the item's state, such as durability.
SettingDoes
Item DefinitionThe item held; a drop sets it.
Stack CountUnits, up to Max Stack Size (1 for a bag).
Physics ModeUse Fragment follows the World Item fragment's Simulate Physics; Force Enabled tumbles and settles; Force Disabled stays put, as on a rack.
Inherited Velocity ScaleShare of release speed kept: 1 all, 0 none.
It shows the Visuals Drop Mesh, else the Mesh, firing On Visuals Ready, and collides as one box that characters and the camera pass through. A dropped bag carries its contents (Get Bag Items).

Picking up

A world item offers Pick Up on Interact (E in the demo), its prompt showing the item's Display Name and Icon (Interaction). Units top up stacks of the item; one carrying state becomes its own stack. Under an inventory config a pickup takes what fits and leaves the rest (Get Units That Fit says how many and why). On Pickup Taken fires on the server as the item goes; Try Pick Up hands it over from your Blueprint.

When there is no room

With no room, Pick Up stays on the prompt with the reason as its verb (No Room, Too Heavy, Can't Carry More, Can't Carry, Out of Reach) and a press does nothing; a rack's Take does the same.
Tick Swap When Full on the inventory config to swap instead: the prompt reads Swap ("Swap Sword for Shield") and a press puts the item in the way down where the drop key would, then takes the new one. The item in the way is one in hand or on a belt slot that takes the new item, one of the same kind first, so a second sword replaces the sword put away on the belt and never the shield in hand. It swaps only when that item has a World Item fragment and putting it down makes room for the whole new stack, and never puts a stack down for more of the same item; otherwise the prompt keeps its reason. At a rack the item put down goes onto the emptied place when it fits. The demo's InventoryConfig_UPC_SingleItem (one slot, Swap When Full) shows it (One Item at a Time).

The reach

With no Pickup Presentation on the character's UPC Interactor, a pickup takes the item at once. Give it one for a reach: a Montage, and a Stand Off Distance, how far from the item the character stands.
Details
InteractorComponent
UPC
Interactor
Pickup
Pickup Presentation
Montage
AM_UPC_Pickup
Play Rate
1.0
Section Name
None
Stand Off Distance
60
Every pickup this character makes plays this reach. Leave Montage empty and items are taken at once.
AM_MyPickup
0.0
0.2
0.4
0.6
0.8
1.0
1.2
1.4
Notifies
UPC Approach Window · Pickup
UPC Gameplay Event · UPC.Event.Interaction.Commit
The approach window walks the character to the stand-off spot; the gameplay event notify takes the item when the hand closes.
The montage carries two notifies. A UPC Approach Window spanning the walk, with Approach Target Name Pickup, moves the character to the spot; without it Stand Off Distance moves nothing. A one-frame UPC Gameplay Event with Event Tag UPC.Event.Interaction.Commit where the hand closes takes the item; without it the item goes at the end. An item lifted differently, such as a crate, ticks Override Pickup Presentation on its World Item fragment for its own reach; one with no montage is taken at once.

Dropping

An item with a World Item fragment can leave the hand and become a world item.
Details
World Item
World Item
Drop Montage
AM_MyDrop
Override Pickup Presentation
Simulate Physics
Impact Sound
SC_MySword_Impact
Impact Silent Speed
50
Impact Full Speed
500
World Item Actor Class
None
Drop Anchor
Held Item
Drop Offset
0.0
0.0
0.0
Project to Ground
Ground Trace Distance
500
Drop Rotation
Preserve Anchor
Rotation Offset
0.0
0.0
0.0
How the item leaves the hand, how it lands, and the sound it makes each time it hits something on the ground.
SettingDoes
Drop MontageThe character letting go; the item leaves at its UPC Equipment Commit notify, else at the end. Empty drops at once.
Simulate PhysicsTumbles and settles, or rests where it lands.
Impact SoundPlays on each hit while falling, silent at Impact Silent Speed (50 cm/s) to full at Impact Full Speed (500 cm/s); an item placed in the level stays silent for its first second.
World Item Actor ClassYour own world item Blueprint (a glowing rare drop).
Drop Anchor, Drop Offset, Project to Ground, Drop RotationWhere and which way up it lands (in detail).

A drop key

A character's ability set grants the plugin's drop ability with an Input Tag (UPC.Input.Drop) and an Input Action (Input). To change what a press drops, grant a Blueprint child of UPCDropAbility instead:
Details
GA_MyDrop
UPC
Drop
Allow During Actions
Item Selection
Combat Driver, Then Any In Hand
Drop Count
1
Skip Undroppable
World Item Class
None
Destroy Undroppable
A Blueprint child of the plugin's drop ability, shown with the shipped defaults.
SettingDoes
Item SelectionWhich item drops: by default the weapon in hand, else any other item in hand (every option).
Drop CountUnits per press (default 1); 0 drops the stack.
Allow During ActionsA drop may start mid-move; UPC.State.EquipmentBlocked refuses one regardless.
Play Drop AnimationOff drops at once, as a screen's drop does.
Skip Undroppable, Destroy UndroppableSkip or destroy an item with no World Item fragment instead of refusing.
World Item ClassWorld item spawned when the fragment names none.
Override Can Drop to forbid a drop (a quest item) and Resolve Drop Transform for a throw; On Item Dropped fires on the server with the new world item. An item in a container out of reach stays; a bag drops with its contents, except items the belt or a hand holds.

Drop from Blueprint

Two server nodes drop without the ability and refuse items with no World Item fragment. Drop Equipment takes one unit of a drawn item off a character, as a disarm does, landing as its fragment says. Drop Item Instance lays units of an owned item at a transform you pass, resting under Physics Mode Force Disabled.
AdvancedDrop settings in detail
  • Item Selection: the first three options read the hands, so they work with no belt, and none picks worn gear. Combat Driver, Then Any In Hand (default): the weapon in hand, else any other item in hand. Combat Driver: only the weapon. Non-Driver First: the shield before the sword, then the sword on the next press. First Drawn Slot: the item in hand on the lowest belt slot. Fixed Slot: the item in Drop Slot Index, in hand or not. From Event: the inventory item a triggering gameplay event names, via an Ability Trigger. Custom: your Resolve Item to Drop.
  • Drop Anchor is Held Item (where the hand held it) or Pawn (the character's center). Drop Offset is in cm, X forward, turned with the character. Project to Ground sets a non-simulating item on the ground, tracing down Ground Trace Distance (500 cm). Drop Rotation keeps the anchor's rotation (Preserve Anchor), faces the character's way (Pawn Yaw) or stands upright (World Upright); Rotation Offset corrects a mesh whose pivot does not lie flat.
  • Drop Equipment on an item drawn with no inventory entry (an enemy's, via Equip Item) drops one unit of it. Its Inherited Velocity Scale, and Drop Item Instance's, at 0 or above replaces the world item's.

Racks and shelves: item holders

A UPC Item Holder holds items in named places such as a rack's pegs: a filled place offers Take, an empty one Put Back when the character carries an item the place accepts that has a World Item fragment. Put Back takes the sword in hand first, then another drawn item, then any other accepted carried item.
  1. Create an Actor Blueprint, BP_MyRack, with Replicates ticked, a Static Mesh, an Arrow tagged SwordPeg where the sword rests, and a UPC Item Holder with one place:
Details
UPC Item Holder
UPC
Item Holder
Places
1 Array element
Index [ 0 ]
Place Id
Sword
Place Component Tag
SwordPeg
Filter
UPC.Slot.Weapon.Sword
Claim Radius
50
Interactable
Options
2 Array elements
Enabled
Anchor Component Tag
None
Anchor Socket
None
Each place is a component on the rack carrying a tag. The two Options rows, Take and PutBack, come with the component; keep their Option Ids.
  1. Place it in a level, with a BP_UPC_WorldItem of Item_MySword within 50 cm of the arrow, its Physics Mode on Force Disabled:
Details
BP_UPC_WorldItem
UPC
World Item
Item Definition
Item_MySword
Stack Count
1
Physics Mode
Force Disabled
Inherited Velocity Scale
1.0
One placed world item. Force Disabled keeps it where it was put instead of letting it fall, which an item resting on a rack wants.
  1. Press Play: E on the sword is Take, and E on the empty peg Put Back.
Components
+ Add
BP_MyRack (Self)
DefaultSceneRoot
Rack
Add
SwordPeg
Add
UPC Item Holder
Add
The arrow carries the component tag SwordPeg, which the Places row names.
Setting or nodeDoes
PlacesEach a unique Place Id, a Place Component Tag naming the item's marker, and a Slot Tag Filter as on a belt slot (empty takes any item).
Claim RadiusHow near, in cm (default 50), a world item must lie for a place to claim it as play begins. The claim ignores the Filter, which judges only what a character puts back.
Can Place IntoWhether a place takes a character's item, by its Filter; override in a Blueprint child (call the parent) to add a rule.
Choose Target Place, Get Item in PlaceThe place looked at most directly; what rests in a place.
AdvancedHow a holder takes and gives
  • As play begins each place, in order, claims the nearest world item in Claim Radius; it hangs from its marker with its own Pick Up off (one that simulates would fall out, with a warning).
  • Put Back sets down one unit of an item that may leave the inventory (Can Item Leave); a bag goes with its contents. Take and Put Back play the pickup reach.
  • Keep the Take and PutBack rows' Option Ids; the holder copies them into a row per place.

Debug it

UPC.Debug.Interaction 1 shows what each character looks at and offers. Log LogUPCInteraction Verbose reports a drop refused for a missing World Item fragment or a playing reach.
AdvancedWhich item goes, and the reason on a prompt of your own
  • Get Swap Item names what goes (an item in hand with a World Item fragment, weapon first); it drops with no drop animation.
  • The prompt selection carries Disabled Reason, the refusal tag (UPC.Inventory.Refused.Full), to gray the row; Get Refused Text gives the words.
The demo
  • BP_UPC_WeaponRack holds two swords and a shield; its BPC_UPC_WeaponRackHolder also requires the item in hand, so a belt item is never offered.
  • BP_UPC_Character reaches with AM_UPC_Pickup. AbilitySet_UPC_Default grants the drop on G, and the screens' GA_UPC_DropFromScreen drops From Event on UPC.Event.DropItem.
MultiplayerWhat runs where
The server makes every change, and world items and holders replicate it.
  • A world item replicates item, count, state, bag contents and movement ten times a second; each machine builds its mesh and plays the Impact Sound from its own simulation.
  • The player's machine plays a Drop Montage from the press and cancels it on refusal.
  • Each machine works out the pickup reach itself, so change a Pickup Presentation on every machine or none.
  • A prompt reads the player's inventory copy; the server asks again before acting.
  • On Pickup Taken and On Item Dropped run on the server; fire a gameplay cue from them for every machine.
C++C++
  • AUPCWorldItem's pick up option is a UUPCWorldItemInteractableComponent named Interactable (id PickUp reserved); InitializeWorldItem and ReduceStack are C++ only. It spawns as the fragment's World Item Actor Class, else the fallback passed in, else AUPCWorldItem, the dropper as Instigator.
  • UUPCDropAbility overrides CanDrop, ResolveItemToDrop, ResolveDropTransform; ResolveItemBySelection and TryDrop are callable. UUPCItemHolderComponent derives from UUPCInteractableComponent; CanPlaceInto and ChooseTargetPlace are Blueprint native events.
AdvancedTroubleshooting
Nothing happens
  • No Take or Put Back on a client: the holder's actor does not replicate; validation warns.
  • Put Back is never offered: the carried item has no World Item fragment, or the Filter or Can Place Into refuses it.
  • A pickup with a reach is hidden: the Interactor's Payload Ability Class is empty or also granted elsewhere; the server's Output Log names it (Interaction).
  • Pick Up does nothing: the world item's PickUp option row was renamed or removed (validation reports it).
  • A placed world item ignores Blueprint option changes: revert its Options.
  • A drop does nothing: no World Item fragment, a move running with Allow During Actions off, or nothing in hand (worn gear is not).