> For the complete documentation index, see [llms.txt](https://malbersanimations.gitbook.io/animal-controller/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://malbersanimations.gitbook.io/animal-controller/malbers-questforge/dialogue-system/nodes/quest-node.md).

# Quest Node

### Overview

The **Quest Node** is the bridge between the Dialogue System and the Quest System. It performs a quest lifecycle action — starting, completing, failing, abandoning, or updating an individual objective's status — directly from within a dialogue graph, then immediately advances to the next node.

It is a **fire-and-forget** node. No waiting occurs; the quest action is issued and the graph continues without pausing.

The node also includes an inline **+** button to create a new `Quest` ScriptableObject asset without leaving the graph editor.

***

<figure><img src="https://963537199-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Lzhr1XSMzMqNXjRnNlb%2Fuploads%2F9qZDU87PuVqvOVK5JEUl%2Fimage.png?alt=media&amp;token=6452991b-6dfe-4a0e-ac20-5051ff066edb" alt=""><figcaption></figcaption></figure>

### Ports

| Port         | Direction | Capacity | Description                                                                                                                                                         |
| ------------ | --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Previous** | Input     | Multi    | Receives connections from any preceding node.                                                                                                                       |
| **Next**     | Output    | Multi    | Advances after the quest action executes. Multi-capacity allows the port to connect to more than one node, though only the first connection is followed at runtime. |

***

### Node Properties

| Property                     | Type     | Description                                                                                                                                                      |
| ---------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Quest**                    | `Quest`  | The Quest ScriptableObject asset to act on. The quest's GUID is displayed below the field once assigned.                                                         |
| **+** *(button)*             | —        | Creates a new `Quest` ScriptableObject asset inline. The asset is saved to a location you choose, assigned to the node, and opened in the Inspector immediately. |
| **Quest Action Type**        | Dropdown | The operation to perform on the quest. See options below.                                                                                                        |
| **Reset All Tasks on Start** | `bool`   | When using the **Start** action, resets all objectives back to their initial state before starting. Useful for repeatable quests.                                |
| **Force Start If Completed** | `bool`   | Allows the **Start** action to restart a quest that has already been completed, enabling quest replay.                                                           |
| **Force If Not Active**      | `bool`   | Allows **Complete**, **Fail**, and **Abandon** actions to run even if the quest is not currently active.                                                         |

***

### Quest Action Types

| Action            | Runtime Call                          | Description                                                                                                                       |
| ----------------- | ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| **Start**         | `QuestManager.StartQuest(questId)`    | Starts the quest, making it active and tracking-eligible. Respects **Reset All Tasks on Start** and **Force Start If Completed**. |
| **Complete**      | `QuestManager.CompleteQuest(questId)` | Marks the quest as completed and triggers its reward pipeline.                                                                    |
| **Fail**          | `QuestManager.FailQuest(questId)`     | Marks the quest as failed.                                                                                                        |
| **Abandon**       | `QuestManager.AbandonQuest(questId)`  | Abandons the quest, removing it from the active list.                                                                             |
| **SetTaskStatus** | —                                     | Targets an individual objective within the quest. Reveals the **Subtask** and **Subtask Action** fields.                          |

***

### SetTaskStatus Fields

These fields are only visible when **Quest Action Type** is set to `SetTaskStatus` and the assigned Quest has at least one objective.

| Property           | Type     | Description                                                                                                                                 |
| ------------------ | -------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| **Subtask**        | Dropdown | Lists all objective IDs from the assigned Quest. Select the specific objective to act on. Populated automatically when a Quest is assigned. |
| **Subtask Action** | Dropdown | The action to apply to the selected objective.                                                                                              |

#### Subtask Action Options

| Option       | Description                                     |
| ------------ | ----------------------------------------------- |
| **None**     | No action — effectively a no-op.                |
| **Start**    | Marks the selected objective as started/active. |
| **Complete** | Marks the selected objective as completed.      |
| **Fail**     | Marks the selected objective as failed.         |

***

### How It Works

At runtime, `DialogueManager.ProcessQuestNode()` resolves the `QuestManager` singleton, reads the quest's `QuestID`, and calls the appropriate method based on the **Quest Action Type**. If no `Quest` is assigned, a warning is logged and the graph advances without performing any action. If `QuestManager` is not present in the scene, an error is logged.

The node always calls `AdvanceToNextNode()` immediately after the action — no waiting occurs regardless of the action type.

***

### Validation

| Condition              | Severity |
| ---------------------- | -------- |
| No incoming connection | Warning  |
| No outgoing connection | Warning  |

> A missing **Quest** asset is not flagged in the graph editor — it is caught at runtime with a warning log. Always ensure the Quest field is assigned before testing.

***

### Usage Tips

* **Start quests through conversation** — the most common pattern is: NPC delivers quest briefing via SimpleDialogue nodes → Quest Node (Start) → NPC delivers closing line → End Node. The quest becomes active mid-conversation without interrupting the flow.
* **Complete quests on turn-in** — when a player returns to an NPC to turn in a quest, use a TrueFalse Node to check if the quest is complete, branch to a Quest Node (Complete) → reward dialogue → End Node on the true path, and redirect elsewhere on the false path.
* **SetTaskStatus for scripted progression** — use `SetTaskStatus` to manually complete or fail specific objectives mid-dialogue. This is useful for objectives that are satisfied by a conversation rather than a gameplay event (e.g. "Talk to the King" fulfilled by reaching the relevant dialogue branch).
* **Force flags for repeatable content** — enable **Force Start If Completed** and **Reset All Tasks on Start** together for quests designed to be repeated (daily quests, challenge runs, etc.).
* **Force If Not Active for edge cases** — enable **Force If Not Active** when you need to clean up quest state defensively, for example failing a quest when a critical NPC dies regardless of whether the player had started it.
* **Creating quests inline** — the **+** button generates a new Quest asset with a unique auto-generated ID. Open the asset in the Inspector immediately after creation to fill in the quest name, description, and objectives before wiring up objectives in the graph.
