Tutorial 1 - Build a shed¶
By the end you’ll have a small mod that adds a “Build Shed” option to the inventory context menu, opens the framework’s placement UI, and lets the player drag a footprint, paint walls and a floor, and build a real, lit, persisted shed - consuming planks, validated, and multiplayer-safe.
This is the RCSFExampleShed
example, explained.
Prerequisites¶
Project Zomboid Build 42.13+.
A mod skeleton (
mod.info+media/lua/). If you don’t have one, scaffold any empty B42 mod first.
Step 1 - Declare the dependency¶
In your mod.info:
name=My Shed Mod
id=MyShedMod
require=RCStructureFramework
require= makes the game load the framework before your mod, so require("RCStructureFramework")
works.
Step 3 - Open the builder (client)¶
Create media/lua/client/MyShedMod/OpenBuilder.lua. This is client-only - the UI is
presentation; the build itself runs server-side through the framework’s timed action.
1require("RCStructureFramework/PlacementUI") -- loads the RCStructurePlacementUI panel
2local Shed = require("MyShedMod/Shed")
3
4local function onFillInventoryContextMenu(playerIndex, context, items)
5 local player = getSpecificPlayer(playerIndex)
6 if not player then return end
7 context:addOption("Build Shed", nil, function()
8 -- (structureId, playerIndex, character, container)
9 RCStructurePlacementUI.open(Shed.STRUCTURE_ID, playerIndex, player, nil)
10 end)
11end
12
13Events.OnFillInventoryObjectContextMenu.Add(onFillInventoryContextMenu)
For clarity this adds the option to every inventory item. A real mod would gate it on a
specific kit/blueprint item (pass that item as the 4th container argument).
Step 4 - Try it¶
Enable My Shed Mod and RCStructureFramework in the mod list, start a world.
Make sure you’ve got a stack of planks.
Right-click any inventory item → Build Shed.
Drag a footprint, paint the walls and floor, and confirm.
You’ll watch the timed action build it plank by plank, get a real room (try a light switch inside after dark), and - on a server - see it appear for every other player.
What you have¶
Without writing any of it yourself: footprint selection, a paint UI with live material and validation feedback, atomic build-or-rollback, runtime room creation, lighting, and full multiplayer sync.
Next¶
Add disassembly so players can take the shed back down: How-to → Disassemble & refund.
Add a door piece (
slotKind = "door",categoryGroup = "door") and a wall sprite for it.Gate the shed behind a skill or magazine: Materials & unlocks.
Move on to Tutorial 2 - Claim a quest room.