Quest Objectives
The key words MUST, MUST NOT, and MAY below are used as in RFC 2119.
Objectives are the win condition of a quest. They are authored in the quest JSON and tracked at runtime by SessionManager; meeting them flips the quest to Completed, which is what unlocks the report action at the guild counter (see Story Progression).
Schema
A quest's objectives is an array of objects, each with item_id, label, and target:
| Field | Meaning |
|---|---|
item_id | the count key — what the player collects / clears |
label | display text for the HUD / log |
target | how many are needed (defaults to 1) |
A quest MAY declare multiple objectives; the quest is complete only when every objective's count reaches its target. Free-roam field quests carry no objectives key (see Quest vs Field) and therefore never enter the Completed state.
Runtime tracking
When the quest session starts (SessionManager.enter_quest, not at accept time), it loads the objective array and seeds a per-item_id count at zero. collect_quest_item(item_id) is the single increment path: it bumps the count, emits quest_item_collected (for the HUD), and — when are_objectives_complete() first returns true — calls mark_quest_complete(), which records the completion and emits the quest_completed signal.
Counts and objectives are part of the suspendable session state, so they survive a telepipe round-trip to the city and back.
What ticks an objective
- Quest-item pickups — the gold collectible star. Walking over it (or closing its pickup dialog) calls
collect_quest_itemonce. Collecting N stars = N increments. - Message logs — a message pack authored with an
objective_item_idticks the count the first time it's read (guarded so re-reads don't double-count). - Defeating enemies — indirectly. There is no direct kill→count hook. A quest item authored with a
room_clearspawn condition is spawned only after the room is cleared; the player still MUST walk over the resulting pickup to register it.
From complete to cleared
mark_quest_complete() stashes the run summary and flips state to Completed (guild tag REPORT). Reporting at the guild counter calls report_quest() then GameState.complete_mission(quest_id), which appends to the persisted completed_missions set (saved per character) — from then on is_mission_completed(id) is true and the counter shows CLEAR. Completion is not persisted until reported.
Implemented by
scripts/autoloads/session_manager.gd(SessionManager) — seeds per-item_idcounts inenter_quest(quest-session start) and runs the increment/completion path:collect_quest_item(),are_objectives_complete(),mark_quest_complete().scripts/autoloads/quest_loader.gd(QuestLoader) —load_quest()parses the quest JSON whoseobjectivesarray SessionManager reads into_quest_objectives.