进阶联动
对话物品
让一件收藏品开启一段可以选择的故事。
写一段由用户选择的故事
对话物品可以触发作者预先写好的文字与选项,例如一封信、一段回忆或分支故事。它使用固定的剧情配置,无需 AI。
下面为示例角色 小伙伴 制作一封信。将角色名换成实际名字,并同步修改 pet_limit。三个文件通过物品名和对话名关联:
| 文件 | 负责什么 |
|---|---|
res/role/小伙伴/items/items_config.json |
定义信件物品 |
res/role/小伙伴/msg_conf.json |
定义故事和选项 |
res/role/小伙伴/pet_conf.json |
将物品与故事关联 |
第一步:创建信件物品
在角色的 items/ 中放入 letter.png。以下是只含一件物品的完整 items_config.json;已有其他物品时只合并 一封信 这一项:
{
"一封信": {
"image": "letter.png",
"description": "一封留在桌面上的信。",
"type": "dialogue",
"cost": 100,
"fv_lock": 0,
"pet_limit": ["小伙伴"]
}
}
dialogue 物品用于触发故事,不必添加食物的饱食度效果。若要升级时赠送,可另外设置 fv_reward 等级列表,见物品字段速查。
第二步:编写文字与选项
下面是完整的 msg_conf.json。已有其他故事时,将 桌边来信 合并进去:
{
"桌边来信": {
"title": "一封信",
"start": "text_1",
"text_1": "今天想一起做些什么?",
"text_2": "好呀,我就在这里陪着你。",
"text_3": "那就先休息一下吧。",
"option_1": "陪我待一会儿吧。",
"option_2": "一起休息一下。",
"relationship": {
"text_1": ["option_1", "option_2"],
"option_1": ["text_2"],
"option_2": ["text_3"]
}
}
}
start 指向开头的文字。text_1 显示时出现两个选项,分别通向 text_2 和 text_3,随后结束。
| 配置 | 含义 |
|---|---|
title |
对话窗口标题 |
text_编号 |
一段正文 |
option_编号 |
用户可点击的选项文字 |
relationship 中的 text_编号 |
当前文字提供哪些选项,可有多个 |
relationship 中的 option_编号 |
这个选项通向哪段文字;列表内只能有一个目标 |
先画出文字和选项之间的连接,再填写配置。所有被引用的节点都必须存在,结尾不要意外连回开头造成循环。
第三步:关联物品与故事
将下面的 msg_dict 合并进角色的 pet_conf.json。若已有此字段,在原对象中增加映射,不要重复写两个 msg_dict:
{
"msg_dict": {
"一封信": "桌边来信"
}
}
左边是 items_config.json 的物品名,右边是 msg_conf.json 的故事名;大小写、空格和标点都要一致。
检查每个分支
在对应角色下获取并使用物品,分别点击所有选项。检查标题、起始文字、每条分支与结束位置。若没有触发,先核对 pet_limit、msg_dict 两端名称,以及文件所在目录。
Write a story with user choices
A dialogue item opens text and choices written by the author: a letter, a memory or a branching story. It uses a predefined script and does not require AI.
This example creates a letter for a character named Companion. Replace that name with the actual character name, including in pet_limit. Three files connect through item and story names:
| File | Responsibility |
|---|---|
res/role/Companion/items/items_config.json |
Define the letter item |
res/role/Companion/msg_conf.json |
Define the story and choices |
res/role/Companion/pet_conf.json |
Connect the item to the story |
Step 1: create the letter item
Put letter.png in the character’s items/ folder. This is a complete single-item items_config.json. If items already exist, merge only the A letter entry:
{
"A letter": {
"image": "letter.png",
"description": "A letter left on the desktop.",
"type": "dialogue",
"cost": 100,
"fv_lock": 0,
"pet_limit": ["Companion"]
}
}
A dialogue item triggers a story and does not need food effects. To award it on a level-up, add a fv_reward list of levels; see the item field reference.
Step 2: write the text and choices
This is a complete msg_conf.json. If other stories exist, merge the Desktop letter entry:
{
"Desktop letter": {
"title": "A letter",
"start": "text_1",
"text_1": "What would you like to do together today?",
"text_2": "Of course. I'll keep you company here.",
"text_3": "Let's take a little break, then.",
"option_1": "Stay with me for a while.",
"option_2": "Let's rest together.",
"relationship": {
"text_1": ["option_1", "option_2"],
"option_1": ["text_2"],
"option_2": ["text_3"]
}
}
}
start identifies the opening text. text_1 offers two choices leading to text_2 and text_3, where the branches end.
| Setting | Meaning |
|---|---|
title |
Dialogue window title |
text_number |
A passage of text |
option_number |
A clickable choice |
A text_number key in relationship |
Choices offered by that passage; multiple choices are allowed |
An option_number key in relationship |
The passage reached by this choice; the list must contain exactly one target |
Sketch the connections before writing the configuration. Every referenced node must exist. Avoid accidentally connecting an ending back to the start and creating a loop.
Step 3: connect the item and story
Merge this msg_dict into the character’s pet_conf.json. If the field exists, add the mapping inside it rather than creating a duplicate msg_dict:
{
"msg_dict": {
"A letter": "Desktop letter"
}
}
The left side is the item name in items_config.json; the right side is the story name in msg_conf.json. Case, spaces and punctuation must match exactly.
Check every branch
Obtain and use the item with the intended character, then try every choice. Check the title, opening passage, branches and endings. If nothing opens, check pet_limit, both names in msg_dict and the file locations first.
文档持续完善中。 查看原始开发文档 ↗