> For the complete documentation index, see [llms.txt](https://docs.convai.com/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/narrative-design/narrative-design-quick-start.md).

# 叙事设计快速开始

从 Blueprint 调用一个命名的叙事触发器，并通过将新的区段 ID 打印到屏幕上来确认区段变化。

我们将对 Convai 角色调用一个命名叙事触发器，并确认故事图表会推进。设置完成后，按下绑定的按键会调用 **调用叙事设计触发器**；当 Convai 推进图表时， **收到叙事章节** 会打印新的 `叙事章节 ID` 到屏幕上。

### 我们将构建的内容

一个角色蓝图，它绑定 **收到叙事章节** 在其 `UConvaiChatbotComponent`，然后调用 **调用叙事设计触发器** 当玩家按下按键时。一个 **打印字符串** 节点，以及 **输出日志** 确认章节变更。

### 前置条件

* Convai Unreal Engine 插件已安装并且 API 密钥已配置。另请参见 [安装 Convai 插件](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/getting-started/install-the-convai-plugin.md) 和 [配置你的 API 密钥](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/getting-started/configure-your-api-key.md).
* 一个角色 `Actor` 带有一个……的蓝图 `UConvaiChatbotComponent` (`Convai 聊天机器人`）和 `CharacterID` 设置为有效 ID。参见 [添加你的第一个 Convai 角色](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/getting-started/add-your-first-convai-character.md).
* 在 Convai 仪表板中为该角色 ID 配置至少一个章节和一个触发器。参见 [叙事设计 | Playground](/api-docs/zh/convai-playground/character-customization/narrative-design.md).

在打开 Unreal Engine 之前，请先在仪表板中确认：

| 检查    | 需要验证的内容                                                 |
| ----- | ------------------------------------------------------- |
| 图表存在  | 该角色至少有一个章节和一个出站触发器。                                     |
| 触发器名称 | 请准确复制触发器名称——它区分大小写。                                     |
| 可达边   | 该触发器是从角色起始章节发出的出站边。                                     |
| 角色 ID | 该 `CharacterID` 在 `UConvaiChatbotComponent` 与仪表板中的角色一致。 |

### 构建蓝图

{% stepper %}
{% step %}

#### 打开角色蓝图

打开包含你的……的 Actor 蓝图 `UConvaiChatbotComponent`。在 **事件图**，在……中的组件上单击 **组件** 面板中将其选中。
{% endstep %}

{% step %}

#### 绑定 On Narrative Section Received

将 `UConvaiChatbotComponent` 从……中的引用 **组件** 面板拖到事件图中。从组件引脚拖出并搜索 **收到叙事章节**。选择 **分配 On Narrative Section Received** 以创建一个已绑定的事件节点。

生成的事件节点会暴露两个输出引脚： `聊天机器人组件` (`UConvaiChatbotComponent` 引用）和 `叙事章节 ID` (`FString`).
{% endstep %}

{% step %}

#### 打印章节 ID

连接一个 **打印字符串** 节点到该事件的执行引脚。将 `叙事章节 ID` 输出引脚接入 **打印字符串**的 `输入字符串` 每当 Convai 推进故事图表时，这都会将新的章节 ID 打印到屏幕上。
{% endstep %}

{% step %}

#### 在按键按下时调用 Invoke Narrative Design Trigger

在事件图中，添加一个 **键盘** 事件节点（例如 `F` 键）。拖出 `UConvaiChatbotComponent` 从……中的引用 **组件** 面板并调用 **调用叙事设计触发器** 其中的

设置 `触发器名称` 与 Convai 仪表板中显示的触发器名称完全一致（例如 `start_inspection`）。将 **按下** 键盘事件的执行引脚连接到 **调用叙事设计触发器**.

{% hint style="info" %}
`bAutoInitializeSession` 默认为 `true` 在 `UConvaiChatbotComponent`，这样会话将以……打开 **开始游戏**。如果你在会话连接之前按下按键，触发器会在……中排队 `PendingTriggers` ，并在连接打开后重新执行。
{% endhint %}
{% endstep %}

{% step %}

#### 在编辑器中运行并激活触发器

点击 **在编辑器中运行**。会话连接后，按下你绑定的按键。观察屏幕上是否打印出章节 ID 字符串。

如果触发器名称与角色当前章节可到达的触发器匹配，Convai 会推进故事图表并 **收到叙事章节** 触发新的 `叙事章节 ID`.

如果没有任何内容打印，请参见 [排查叙事设计问题](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/narrative-design/troubleshoot-narrative-design.md)。常见原因：触发器名称不匹配，错误的 `CharacterID`，或者仪表板中未将触发器连接到当前章节。
{% endstep %}
{% endstepper %}

屏幕上打印出一个非空的章节 ID，说明 Convai 已接收到触发器并推进了故事图表。

### 下一步

{% content-ref url="/pages/ff19704aac20f7d6e4bf5c3214636ccbe4248151" %}
[叙事触发器](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/narrative-design/narrative-triggers.md)
{% endcontent-ref %}

{% content-ref url="/pages/453cd3ea71434b9c4a8a7da307779eeb39996f99" %}
[模板键](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/narrative-design/template-keys.md)
{% endcontent-ref %}

{% content-ref url="/pages/7df13f2b93b6b95a4cdb5669073a1869b071babe" %}
[叙事设计的工作原理](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/narrative-design/how-narrative-design-works.md)
{% endcontent-ref %}

如果触发器调用已执行但在编辑器中运行时未打印章节 ID，请使用故障排除页面。

{% content-ref url="/pages/609986e3902c22d2027f232e5ffaaa507011c8a0" %}
[排查叙事设计问题](/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/narrative-design/troubleshoot-narrative-design.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.convai.com/api-docs/zh/cha-jian-yu-ji-cheng/convai-unreal-engine-plugin/features/narrative-design/narrative-design-quick-start.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
