开始创作
读懂与修改配置
先认识文件、字段和引用,避免第一次修改就被格式绊住。
配置文件是什么?
JSON 用字段告诉软件“使用哪张图、播放哪个动作、增加多少数值”。图片和声音仍是独立文件,配置只记录如何找到和使用它们。
{
"image": "apple.png",
"cost": 200,
"enabled": true,
"examples": ["first", "second"]
}
这是 JSON 语法示意,不是软件模组模板。字符串用英文双引号包围;数字不加引号;布尔值写成小写 true / false;列表用 [],对象用 {}。
修改时最容易出错的地方
- 字段之间用英文逗号分隔,最后一项后面不加逗号。
- 不要把中文引号、中文冒号、注释或
...直接写入 JSON 文件。 - 同一对象中的字段名不要重复。已有
random_act时,在原有列表里添加动作,不再新建第二个同名字段。 - 文件名、动作名和物品名逐字匹配,包括大小写和扩展名。
- 用纯文本编辑器保存 UTF-8 文本,保留
.json后缀,避免变成.json.txt。
完整文件与合并片段
教程会在代码前说明文件位置,以及示例是否完整。
完整文件示例可以作为新文件的起点,但必须同时准备它引用的素材。合并片段只表示要添加的字段或列表项,不应替换你的整个配置文件。
修改已有模组前先复制一份。每次改少量内容,然后通过软件的模组导入检查和实际交互测试确认结果。
三种名字,不要混淆
| 名字 | 示例 | 在哪里使用 |
|---|---|---|
| 图片前缀 | stand |
对应 stand_0.png 等帧,填在动作的 images |
| 动作名 | idle |
act_conf.json 的键,被 default、act_list 等引用 |
| 动作组名 | 睡觉 |
行为配置中的 name,可被 day_night.sleep 等引用 |
有些示例碰巧让它们同名,但三者的职责仍然不同。先顺着引用关系查找,通常比反复改文件名更有效。
What is a configuration file?
JSON tells the app which image to use, which animation to play and how much to change a stat. Images and sounds remain separate files; the configuration describes how to find and use them.
{
"image": "apple.png",
"cost": 200,
"enabled": true,
"examples": ["first", "second"]
}
This demonstrates JSON syntax, not a mod template. Strings use double quotes; numbers do not. Booleans are lowercase true / false. Lists use []; objects use {}.
Common editing mistakes
- Separate fields with commas, but do not add a comma after the last entry.
- Do not put full-width punctuation, comments or
...into a JSON file. - Avoid duplicate keys in one object. Add actions to an existing
random_actlist instead of creating a second field with the same name. - Match file, animation and item names exactly, including case and extensions.
- Save UTF-8 plain text with a
.jsonextension, not.json.txt.
Complete files and merge fragments
Each example identifies its destination and whether it is complete.
A complete file example can start a new file, but still needs every referenced asset. A merge fragment shows only the fields or list entries to add. It must not replace your entire existing configuration.
Copy a mod before editing it. Make small changes, then check them through mod import and actual interactions in the app.
Three different kinds of names
| Name | Example | Where it is used |
|---|---|---|
| Image prefix | stand |
Matches frames such as stand_0.png; used in images |
| Animation name | idle |
Key in act_conf.json; referenced by default, act_list and other fields |
| Action-group name | Sleeping |
A behavior group’s name; referenced by fields such as day_night.sleep |
Examples sometimes use identical names for all three, but their roles still differ. Follow the references when troubleshooting instead of repeatedly renaming files.
文档持续完善中。 查看原始开发文档 ↗