Tutorial 2 - Claim a quest room¶
You don’t always want the player to build a room - sometimes a quest, prefab, or zone mod just needs the engine to treat an existing area as a real room: for room detection, lighting, “are you inside the vault?” checks, and the map.
In this tutorial you’ll claim a hand-picked area as a room when a quest starts, and release it
when the quest ends - server-side, persisted, and MP-synced - using
RCSF.Rooms. No walls, no UI.
The idea¶
RCSF.Rooms.assign(rectOrRects, name, opts) creates a real IsoRoom over any area and
returns a descriptor you keep. RCSF.Rooms.unassign(...) tears it down. Both are
server-authoritative - call them from server-side quest logic.
Step 2 - Trigger it¶
Hook the quest to whatever should start it - reading a note, entering a trigger zone, a command. Here’s a debug command and a server hook:
1local Quest = require("VaultQuest/Quest")
2
3-- Example: start the quest the first time the server boots a fresh world.
4Events.OnServerStarted.Add(function()
5 if not Quest.isActive() then Quest.begin() end
6end)
7
8-- Example: react to entry. OnRCSFRoomAssigned fires when the room is claimed.
9Events.OnRCSFRoomAssigned.Add(function(info)
10 if info.id == "vault_quest" then
11 print("[VaultQuest] room " .. info.name .. " is live (" .. #info.rects .. " rect)")
12 end
13end)
Server-authoritative spawners register on OnServerStarted
On a dedicated server, OnGameStart never fires - use OnServerStarted (or OnServerStarted
an SP fallback) for anything that must run once on the authoritative side.
Step 3 - Verify¶
Start a world with the mod enabled (the
OnServerStartedhook claims the room).Walk into the area: open the debug room-info overlay, or place a light switch inside after dark - it lights the room, proving the engine sees a real
IsoRoom.Call
Quest.finish()(e.g. from a debug option) and confirm the room is gone.Relog: the room is still there until you finish the quest - it persisted.
Multi-rect vaults¶
A bigger vault can be several rectangles; edge-adjacent ones become one building:
Quest.AREA = {
{ x = 10600, y = 9420, z = 0, w = 6, h = 5 },
{ x = 10606, y = 9420, z = 0, w = 4, h = 5 }, -- adjacent → same building
}
Pass it the same way; assign/unassign handle the list.
Next¶
How-to → Assign a room - the full options reference.
Concepts → Authority & rooms - why this is server-side.