# Pickups, Drops and Holders

> 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.

Markdown version of https://rigbak.com/docs/universal-player-combat/pickups-drops-holders, a page of the Universal Player Combat documentation. Link that page when citing it.

## Set it up (4 minutes)

1. **Let the sword lie in the world**

   Add a **World Item** fragment to `Item_MySword` from the [Items](https://rigbak.com/docs/universal-player-combat/items) quick start. It draws a mesh only with a Visuals fragment too.
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. **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. **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.

| Setting | Does |
| --- | --- |
| **Item Definition** | The item held; a drop sets it. |
| **Stack Count** | Units, up to Max Stack Size (1 for a bag). |
| **Physics Mode** | **Use Fragment** follows the World Item fragment's **Simulate Physics**; **Force Enabled** tumbles and settles; **Force Disabled** stays put, as on a rack. |
| **Inherited Velocity Scale** | Share 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](https://rigbak.com/docs/universal-player-combat/interaction)). Units top up stacks of the item; one carrying state becomes its own stack. Under an [inventory config](https://rigbak.com/docs/universal-player-combat/inventory-containers) 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](https://rigbak.com/docs/universal-player-combat/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 panel: InteractorComponent** (component, in AUPCCharacterBase)

**Category: UPC > Interactor > Pickup > Pickup Presentation**

| Property | Value |
| --- | --- |
| 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.*

**Timeline: AM_MyPickup** (1.4 s long). Tracks:

- **Notifies**: UPC Approach Window · Pickup (0 s to 0.4 s); UPC Gameplay Event · UPC.Event.Interaction.Commit (at 0.65 s)

*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 panel: World Item** (instanced object, in ItemPreset_MyWeapons)

**Category: World Item**

| Property | Value |
| --- | --- |
| Drop Montage | AM_MyDrop |
| Override Pickup Presentation | false |
| Simulate Physics | true |
| 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) |
| Project to Ground | false |
| Ground Trace Distance | 500 (greyed out) |
| Drop Rotation | Preserve Anchor |
| Rotation Offset | (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.*

| Setting | Does |
| --- | --- |
| **Drop Montage** | The character letting go; the item leaves at its **UPC Equipment Commit** notify, else at the end. Empty drops at once. |
| **Simulate Physics** | Tumbles and settles, or rests where it lands. |
| **Impact Sound** | Plays 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 Class** | Your own world item Blueprint (a glowing rare drop). |
| **Drop Anchor**, **Drop Offset**, **Project to Ground**, **Drop Rotation** | Where and which way up it lands ([in detail](https://rigbak.com/docs/universal-player-combat/pickups-drops-holders#drop-settings-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](https://rigbak.com/docs/universal-player-combat/input#abilities-that-answer-a-key)). To change what a press drops, grant a Blueprint child of `UPCDropAbility` instead:

**Details panel: GA_MyDrop** (Blueprint, in Class Defaults)

**Category: UPC > Drop**

| Property | Value |
| --- | --- |
| Allow During Actions | false |
| Item Selection | Combat Driver, Then Any In Hand |
| Drop Count | 1 |
| Skip Undroppable | false |
| World Item Class | None |
| Destroy Undroppable | false |

*A Blueprint child of the plugin's drop ability, shown with the shipped defaults.*

| Setting | Does |
| --- | --- |
| **Item Selection** | Which item drops: by default the weapon in hand, else any other item in hand ([every option](https://rigbak.com/docs/universal-player-combat/pickups-drops-holders#drop-settings-in-detail)). |
| **Drop Count** | Units per press (default 1); 0 drops the stack. |
| **Allow During Actions** | A drop may start mid-move; `UPC.State.EquipmentBlocked` refuses one regardless. |
| **Play Drop Animation** | Off drops at once, as a screen's drop does. |
| **Skip Undroppable**, **Destroy Undroppable** | Skip or destroy an item with no World Item fragment instead of refusing. |
| **World Item Class** | World 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.

<details>
<summary>Drop settings in detail (Advanced)</summary>

- **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.

</details>

---

## 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 panel: UPC Item Holder** (component, in BP_MyRack)

**Category: UPC > Item Holder**

| Property | Value |
| --- | --- |
| Places | 1 Array element |
| Places > Index [0] > Place Id | Sword |
| Places > Index [0] > Place Component Tag | SwordPeg |
| Places > Index [0] > Filter | UPC.Slot.Weapon.Sword |
| Claim Radius | 50 |

**Category: UPC > Interactable**

| Property | Value |
| --- | --- |
| Options | 2 Array elements |
| Enabled | true |
| 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.*

2. 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 panel: BP_UPC_WorldItem** (Blueprint, in Level)

**Category: UPC > World Item**

| Property | Value |
| --- | --- |
| 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.*

3. Press Play: E on the sword is **Take**, and E on the empty peg **Put Back**.

Components panel of **BP_MyRack**:

- DefaultSceneRoot (inherited)

  - Rack (add)
  - SwordPeg (add)
- UPC Item Holder (add)

*The arrow carries the component tag SwordPeg, which the Places row names.*

| Setting or node | Does |
| --- | --- |
| **Places** | Each 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 Radius** | How 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 Into** | Whether 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 Place** | The place looked at most directly; what rests in a place. |

<details>
<summary>How a holder takes and gives (Advanced)</summary>

- 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.

</details>

---

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

<details>
<summary>Which item goes, and the reason on a prompt of your own (Advanced)</summary>

- **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.

</details>

<details>
<summary>The demo</summary>

- `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`.

</details>

<details>
<summary>What runs where (Multiplayer)</summary>

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.

</details>

<details>
<summary>C++</summary>

- `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.

</details>

<details>
<summary>Troubleshooting (Advanced)</summary>

**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](https://rigbak.com/docs/universal-player-combat/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).

</details>

---

Previous page: [Quick Bar](https://rigbak.com/docs/universal-player-combat/quick-bar). Next page: [Inventory](https://rigbak.com/docs/universal-player-combat/inventory)
