Documentation menu

Build a quest

Description: Introduce an objective, wait for player progress, and complete the quest.

A quest graph introduces objectives and updates them as the player makes progress. This tutorial creates a small quest with one objective, a condition that waits for the game, and a successful ending.

In this quest, Mira Thorne has lost her ledger on the mountain road. The player must find it before the quest completes.

Tutorial project. Download the project to follow these steps. Open create_quest to begin. The create_quest_final project contains the completed result.

The finished graph

Drag to pan, use the zoom buttons or scroll to zoom, and select Fit graph to see the whole graph.

Open the graph view

Select Quests & Dialogues in the left sidebar or press ⌥2.

The Quests & Dialogues view with its sidebar icon highlighted

The left panel lists graphs, the middle panel contains the canvas, and the right panel shows properties when open. Edit objective details directly on their nodes. Select a node and choose Properties in its toolbar to open secondary settings beside it, even with the side panel hidden.

Create and name a quest

Select Add in the toolbar, then choose Quest.

The Add menu showing Dialogue, Quest, and Quest Fragment

Enter LostLedger for the new graph name and press Enter.

The graph name editor in the tree

Game code uses this name as the quest identifier. It can contain letters, numbers, and underscore characters without spaces.

This tutorial doesn't need a Quest Fragment, which moves part of a larger quest into another graph.

Add a title and description

Clear the canvas selection and open Properties, then choose Quest Info. Enter the Title and Description. Hide Properties again when you return to editing nodes.

The quest properties with the title completed

  • Name: identifier used by game code.
  • Title: player-facing quest name for a journal.
  • Description: summary shown with the quest.

The pale green Quest Node marks the graph entry. Narratyr creates it with the quest and prevents its deletion. The node displays the graph title.

Narratyr also creates a Complete Quest node. Move it below the entry while you build the main path, then connect it at the end of this walkthrough. Without a path to that node, the graph can stop without reporting success or failure to your game.

Add an objective

Drag from the handle on the right side of the Quest Node to an empty canvas area. Releasing the connection opens the insert menu. Choose Introduce Objective under Objectives to create an Objective node. The menu groups related actions under section headings.

The grouped insert menu with Introduce Objective highlighted

Keyboard shortcuts can also add nodes at the pointer. Use O for Objective, G for Gate, U for Update Objective, and F for Complete Quest. The canvas menu lists the same commands.

Select the new Objective and complete the fields on the node.

The inline objective editor with its type, name, and fields

  • Type: select Fetch. The selected type controls the additional fields, which are an item and quantity in this project.
  • Name: enter the player-facing text shown in the quest log.
  • Description: enter the objective details shown to the player.
  • Fields: set itemTypeId and count for your game. Game code uses these fields to detect completion. Narratyr doesn't inspect them.
  • Optional and Hidden: leave both settings off for this required, visible objective.

Select Properties in the node toolbar to open its canvas popup. Close it with the × button or Esc when you finish. You can also use the right properties panel.

Objective properties open beside the node with both side panels hidden

The Objective node introduces the task and continues immediately. A later Update Objective node records completion.

Create a progress variable

Open Variables, select Add Variable, and name it LostLedger_HasLedger.

The Add Variable panel with the new name

The text before the last underscore acts as a name prefix. It groups related rows in the editor and places variables in the same file for split projects.

A new variable starts as an integer. Select its Type cell twice to open the editor, then choose boolean. Open Default Value the same way and set it to false.

The new true or false variable in the Variables table

Game code changes this value when the player picks up the ledger. Variables explains how Narratyr and your game share state.

Wait for progress

Return to the quest. From the Objective output, choose Wait for Condition (Gate) to create a Gate. A Gate pauses its branch until its condition becomes true.

Select the Gate to view its condition modes.

The Gate offering variable, objective, and expression modes

  • Wait on Variable: select one or more true or false variables. The Gate resumes after all selected values become true.
  • Wait on Objective: select an objective and required state. This mode avoids an extra variable, but game code must update the objective by its ID.
  • Wait on Expression: enter any condition supported by the expression language, such as Gold >= 10 and not HasMap.

Each mode creates a condition. The runtime checks a paused Gate again after the relevant state changes.

Choose Wait on Variable, then select LostLedger_HasLedger.

The Gate waiting on LostLedger_HasLedger

Complete the objective

Create an Update Objective node from the Gate output. Keep Quest set to Current quest and select the earlier Objective on the node. In the toolbar beneath it, select the Completed checkmark under Status.

The Update Objective node with Completed status

Update Objective changes only the fields you select. Leave a toolbar choice unselected to preserve that value; clicking a selected button clears it. The toolbar can also reveal or reopen an objective, change its optional flag, or mark it as failed.

Complete the quest

Move the existing Complete Quest node to the right of Update Objective and connect Update Objective's output to its input. Select Complete Quest to show its toolbar and leave Status set to Success (the checkmark). The other status button selects Failure.

Leave both Behavior buttons unselected to use the graph default: end a standalone quest or return from a quest fragment. End Quest and Return override that default; clicking the selected button again restores it.

The Complete Quest node with Success status

Complete Quest ends the flow and reports the result to your game. A quest can have several ending nodes for different outcomes.

Arrange and save the quest

Select the expand button in the upper-right corner of the canvas to hide the side panels.

The completed quest before automatic arrangement

Select Auto-arrange on the lower-left toolbar to arrange the graph. You can also choose Auto Arrange from the canvas menu or press ⇧⌘A. The nearby frame button shows the complete graph.

The arranged quest from entry to completion

The runtime introduces the objective and waits at the Gate. After the game changes LostLedger_HasLedger, the runtime completes the objective and quest.

Press ⌘S to save. An asterisk beside the project name indicates unsaved changes.

Next

Quests covers Hubs, Forks, Event Listeners, and Start Dialogue nodes. Variables and conditions explains the state read by a Gate, and Build a dialogue creates a conversation that can change quest state.