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.
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.
| Field | Type | Meaning |
|---|---|---|
Slot Tag | FGameplayTag | The slot type. Matched against a definition's Equipment Slot Tag. |
Slot Count | int32 | How many indices this slot type has. Clamped to a minimum of 1. |
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.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.
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.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.
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.
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.
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