Building the equipment tab — I can finally equip a sword
Built the equipment tab from the mockup and hooked equipping/unequipping into the inventory and stats. Along the way I hit a bug where an equipped sword vanished after saving, so the save data went up to v4.
Last time (173) I built the character tab, but every equipment slot just said "None." The starter sword was sitting in the bag with no way to actually equip it, which felt a bit empty. This time I took equipment mockup #2 that I'd picked back in 167 (big portrait + three vertical equipment slots) and turned it into a real screen.
Screens I built
Private image
On the left there's a big portrait with soft, faded edges so it blends into the background. Below it are three slots: weapon, armor and accessory. When you highlight a candidate, its icon shows up faintly in the slot first, so you can see how it'll look before you equip it.
Top right is the list of gear that fits the selected slot. What you're wearing now is marked "Equipped," and what's in your bag shows as "Owned N." If there's nothing to equip, it says "No weapons available to equip."
The STATUS CHANGE panel at the bottom right is my favorite part of this screen. It shows attack, defense and range as "now → after the swap," green if a stat goes up and red if it drops. One glance at the numbers and you know whether the swap is worth it.
Controls: ↑↓ to move between slots, ←→ to switch characters, F to equip. The mouse works too.
Private image
Equipping the starter sword (+10) takes attack from 15 to 25, and the character tab updates right away.
Things I thought about
- Equipping takes the item out of the bag. If the same sword sits in both the bag and an equipment slot, it gets confusing, and you could even sell it at the shop while it's still equipped. So equipping means "take it out of the bag and put it in the slot." Equipped gear doesn't show up in the shop's sell list either.
- No unequipping when the bag is full. The scariest thing is a half-finished operation that deletes or duplicates an item. Like shop trades (step 33), it either fully succeeds or doesn't happen at all, and you get a "Not enough inventory space" message.
- Combat comes later. Combat units still use the old default stats. I decided to finish the menu work (GUI step 9) first and wire it into combat separately.
Rabbit hole: the sword vanished after save and load
Equipping removes the sword from the bag, but the equipment slots weren't being saved. So after loading, the sword was in neither the bag nor the slot. It just evaporated.
I bumped the save data from v3 to v4 and made it save party info too (characters + gear per slot). It's collected at the same moment as the inventory, and validation, applying and rollback all happen as one unit. Old saves (v1–v3) still open, filled in as "Karin alone, no gear." But if a save contains an unknown item or gear that doesn't fit its slot, the whole load is blocked. Better that than a save that half-opens.
I ran equip → save → unequip → load, and both the equipped state and the 25 attack came back correctly.
Next up
- There are no armor or accessory items yet, so those two slots are empty
- Apply equipment stats in combat
- Save current HP/MP too (right now loading always gives you full HP/MP)