How-To: Shape the Slot Layout

Goal: decide which slots a pawn has, give a slot several indices, change the layout at runtime, and understand what happens when a slot is already full.

Prerequisites
Quick Start steps 2 and 3 (slot tags authored, the slots component on your pawn).

1. Author the static layout

Slot Layout is an array of FCrimsonEquipmentSlotDefinition - a tag and a count. It is EditDefaultsOnly, so it is authored once in the Blueprint's Details panel.

FieldTypeMeaning
Slot TagFGameplayTagThe slot type. Matched against a definition's Equipment Slot Tag.
Slot Countint32How many indices this slot type has. Clamped to a minimum of 1.
The layout is not replicated
UCrimsonEquipmentSlotsComponent has no replicated state on purpose - both machines build the same layout from the same Blueprint defaults, so replicating it would only cost bandwidth. That also means a layout changed at runtime on the server does not reach clients; see step 3.
Verify
Select the component in your pawn: Slot Layout lists one entry per slot type with the counts you set.

2. Give a slot several indices

Set Slot Count above 1 and the same tag gains indices 0 .. Count - 1. Two ring slots is one entry with a count of 2, not two entries.

In the layout array, add one entry: Slot Tag = Equipment.Slot.Ring, Slot Count = 2. To equip into a particular finger, pass Specific Slot Index = 0 or 1 to Equip Item; pass -1 to let the manager fill the first free one.

When every index is full, index 0 is displaced
With Specific Slot Index = -1 and no free index, the manager targets index 0 and displaces whatever is there rather than refusing. If your design should refuse instead, check occupancy before you call, or block it from Can Equip Item - see How-To: Gate Equipping and Unequipping.
Verify
Equip three rings into a two-count slot: the third replaces the ring at index 0, and the displaced one is reported as Displaced Source when you equip through the bridge.

3. Change the layout at runtime

Set Slot Layout replaces the whole array. Use it for a character who unlocks a second weapon slot, and call it on the server before any equip that needs the new slot.

Get Component By Class (Crimson Equipment Slots) -> Get Slot Layout -> modify the array (or build a fresh one) -> Set Slot Layout. Because the component is not replicated, run the identical call on every machine that needs the new layout - either from replicated state you already have, or from a Multicast event your project owns.

If only the server ever reads the layout, the server-side call alone is enough. Client UI that draws one cell per slot needs the client's copy updated too.

Verify
After the call on the server, equipping a second weapon with Specific Slot Index = -1 lands at index 1 instead of displacing index 0.

4. Compute a layout instead of authoring one

Find Slot Definition is a BlueprintNativeEvent. Override it in a Blueprint or C++ child of the slots component when the answer depends on something other than a fixed array - a class, a level, a body type.

Create a Blueprint child of Crimson Equipment Slots Component, then override the Find Slot Definition event. Return true and fill Out Def for a slot the pawn has; return false for one it does not.

Add the child component to your pawn instead of the base class. Equip Item calls this override whenever it resolves a slot index.

Keep the override deterministic across machines
The manager asks this on the server when it resolves an index, and your UI asks it on the client when it draws cells. If the two answers differ, the client draws slots the server will not fill. Base the override only on state that is already replicated.
Verify
With the override returning a count of 2, equipping two rings fills indices 0 and 1; with it returning 1, the second ring displaces the first.

5. What happens with no slots component at all

The manager tolerates a pawn with no slots component - it logs a warning and skips slot validation entirely. Every equip then targets index 0 of the definition's tag, and each new item displaces the last.

Useful for the simplest cases
A pawn that can only ever hold one weapon needs no layout at all. Add the slots component the moment you want more than one index or want wrong slot tags rejected.
Verify
Remove the slots component and equip: the item still equips, LogCrimsonEquipment warns that no slots component was found, and a second equip of the same slot tag replaces the first.

See also

  • How-To: Gate Equipping and Unequipping
  • How-To: Add Slots with a Game Feature
  • Concept: Slots and Displacement