> For the complete documentation index, see [llms.txt](/llms.txt)

# Equipment Loadout

Gives each character its own equipment slots, with per-slot restrictions on what fits.




**About this demo**

The demo signs in automatically with an anonymous account. The account is shared across every demo in the showroom, so items and currency you get in one demo carry over to the others. Loading takes a moment. If the frame is too small, open the demo in a new tab.

## Overview

Recruit characters, take equipment, and put it into each character's own `weapon` and `armor` slots. Each slot only accepts certain equipment: `weapon` takes `iron-sword` and `oak-staff`, and `armor` takes only `steel-shield`. Put the wrong piece in a slot and GS2 itself refuses it, not the page. A piece of equipment can be worn by only one character at a time.

## How to try it

1. Press **Recruit** under **Recruit a character** to recruit a character. A tab for it appears at the top of **Loadout**.
1. Press **Take** under **Take equipment** to take a piece of equipment. It shows up among the equipment cards in **Loadout**.
1. In **Loadout**, pick a character's tab, tap a slot card (`weapon` or `armor`) to choose where equipment goes, then tap an equipment card to put it in that slot.
1. With the `weapon` slot chosen, tap `steel-shield`; GS2 refuses it and a message starting with `GS2 refused` appears.
1. A piece already worn by another character is refused too. Remove it from that character with the **Take off** button first.

Each equipment card shows who is wearing it and in which slot after **Worn by**. If the bag fills up, press **Expand** under **Equipment bag** to add room.

## GS2 services used

- [GS2-Formation](/microservices/formation/): A GS2-Formation property form model defines the `weapon` and `armor` slots each character has. Each slot's `propertyRegex` limits which equipment item sets it accepts, and GS2-Formation refuses anything that does not match.
- [GS2-Inventory](/microservices/inventory/): GS2-Inventory holds the characters and the equipment in separate inventories. Putting a piece on fetches the equipment's item set with a signature and passes that signature to the slot.
- [GS2-Script](/microservices/script/): A GS2-Script script runs whenever a form is updated and marks the equipment's item set with the character wearing it. It refuses a piece another character is wearing, so each piece is worn by one character at a time.
- [GS2-Exchange](/microservices/exchange/): GS2-Exchange rate models define **Recruit** and **Take** as free transactions that grant a character or a piece of equipment.

## Use it in GS2 Studio

In GS2 Studio's Simple mode, open **Add features** and press **Add** on **Equipment Loadout** to bring this feature into your own project. To point at the package directly, choose **Add from GitHub** and enter the package below.

```text
https://github.com/gs2io/gs2-studio-package/tree/main/micro-economy-equipment-loadout/packages/micro-economy-equipment-loadout
```

- Owner: `gs2io`
- Repository: `gs2-studio-package`
- Subdirectory: `micro-economy-equipment-loadout/packages/micro-economy-equipment-loadout`

## Source code

- Demo project: <https://github.com/gs2io/gs2-studio-package/tree/main/micro-economy-equipment-loadout/live-demo>
- Feature package: <https://github.com/gs2io/gs2-studio-package/tree/main/micro-economy-equipment-loadout>



