进阶联动
可穿戴物品
把收藏品变成跟随角色的翅膀、披风或装饰。
从收藏品到穿戴效果
Equip 将收藏品与角色的组件动画关联。用户使用物品后,装饰会持续显示;再次使用或通过组件右键菜单可以收回。持续显示的穿戴组件会被记录,并在下次启动时恢复。
物品仍为 collection 类型,没有 equip 物品类型。equip 只填写在角色组件的 acc_type 中。
第一步:定义收藏品
以下是单件物品的完整 items_config.json。将 wings.png 放入同一物品模组文件夹;已有配置时只合并物品条目:
{
"小翅膀": {
"image": "wings.png",
"description": "陪着小伙伴一起展开的小翅膀。",
"type": "collection",
"cost": -1,
"fv_lock": 3,
"fv_reward": [3],
"pet_limit": ["小伙伴"]
}
}
示例设定为好感 3 级赠送、不在商店出售。将 小伙伴 换成实际角色名。pet_limit 不是 Equip 必填字段,但适合限制角色专属外观。
第二步:定义组件动画
在角色 action/ 放入 wings_0.png、wings_1.png 等透明 PNG。静态装饰可只有一帧。将下面的 wings 条目合并到角色已有的 act_conf.json:
{
"wings": {
"images": "wings",
"anchor": [0, 0],
"act_num": 1,
"need_move": false,
"direction": null,
"frame_move": 0,
"frame_refresh": 0.06
}
}
背包中的 wings.png 是物品图标,action/wings_0.png 等是显示在角色身上的动画,两者可以采用不同尺寸。
第三步:关联同名组件
将下面这个对象加入 pet_conf.json 的 accessory_act 列表。没有该列表时先创建;不要覆盖已有组件:
{
"name": "小翅膀",
"act_list": [],
"acc_list": ["wings"],
"act_type": [0, 10000],
"anchor": [-64, -128],
"act_prob": 0,
"acc_type": "equip",
"follow_main": true,
"follow_lock": true,
"timeout": false,
"unique": true,
"closable": true,
"above_main": false
}
name 必须与物品名 小翅膀 完全一致。acc_list 引用动画名 wings。这里的 anchor 只是演示值,需要按自己的画布微调。
关键字段速查
| 字段 | 推荐值 / 用途 |
|---|---|
name |
与物品名完全一致 |
act_list |
[],生成组件时不额外播放角色动作 |
acc_list |
角色 act_conf.json 中定义的组件动画列表 |
act_type / act_prob |
[0, 10000] / 0,不作为普通随机动作播放 |
acc_type |
equip |
follow_main / follow_lock |
true / true,跟随角色且位置即时锁定 |
timeout |
false,持续显示并允许下次启动恢复 |
unique |
true,同名组件唯一,再次使用可收回 |
closable |
true,允许通过组件菜单收回 |
above_main |
false 在整个角色下层,true 在整个角色上层 |
anchor |
相对角色画布底边中心定位组件;水平向右、垂直向下为正 |
检查素材与位置
穿戴组件跟随角色整体位置,不会自动识别身体轮廓,也不会随姿势变形。画布尺寸和身体基准位置越一致,越容易贴合。
分别测试待机、行走、睡眠、下落和常用特殊动作,并检查再次使用与重启恢复。above_main 无法让同一组件的一部分在角色前面、另一部分在后面;动作幅度很大时,可考虑将外观直接画进角色动画。
Turn a collectible into an accessory
Equip connects a collectible to a character’s accessory animation. Using the item displays the decoration persistently; using it again or choosing the accessory’s context-menu command retracts it. Persistent equipment is saved and restored on the next launch.
The item remains a collection. There is no equip item type. Set equip only in the character accessory’s acc_type.
Step 1: define the collectible
This is a complete single-item items_config.json. Put wings.png in the same item-mod folder; merge just the item entry if configuration already exists:
{
"Little Wings": {
"image": "wings.png",
"description": "A little pair of wings for your companion.",
"type": "collection",
"cost": -1,
"fv_lock": 3,
"fv_reward": [3],
"pet_limit": ["Companion"]
}
}
This example awards the item at affection level 3 and does not sell it in the shop. Replace Companion with the actual character name. pet_limit is optional for Equip but useful for character-specific appearances.
Step 2: define the accessory animation
Put transparent PNGs named wings_0.png, wings_1.png and so on in the character’s action/ folder. A static decoration can use one frame. Merge the wings entry below into the character’s existing act_conf.json:
{
"wings": {
"images": "wings",
"anchor": [0, 0],
"act_num": 1,
"need_move": false,
"direction": null,
"frame_move": 0,
"frame_refresh": 0.06
}
}
wings.png is the inventory icon; action/wings_0.png and subsequent frames appear on the character. They may use different dimensions.
Step 3: connect an accessory with the same name
Append this object to the accessory_act list in pet_conf.json. Create the list if absent; preserve existing entries:
{
"name": "Little Wings",
"act_list": [],
"acc_list": ["wings"],
"act_type": [0, 10000],
"anchor": [-64, -128],
"act_prob": 0,
"acc_type": "equip",
"follow_main": true,
"follow_lock": true,
"timeout": false,
"unique": true,
"closable": true,
"above_main": false
}
name must exactly match the item name Little Wings. acc_list references the animation wings. The anchor values are illustrative; adjust them for your artwork.
Key field reference
| Field | Recommended value / purpose |
|---|---|
name |
Exactly matches the item name |
act_list |
[]; displaying equipment does not play an extra character action |
acc_list |
Accessory animations defined in the character’s act_conf.json |
act_type / act_prob |
[0, 10000] / 0; exclude from normal random playback |
acc_type |
equip |
follow_main / follow_lock |
true / true; follow the character with immediate position locking |
timeout |
false; remain visible and allow restoration on the next launch |
unique |
true; keep one instance and retract it on repeated use |
closable |
true; allow retraction through the accessory menu |
above_main |
false below the whole character, true above the whole character |
anchor |
Position relative to the bottom-center of the character canvas; right and down are positive |
Check artwork and placement
Equipment follows the character’s overall position. It does not recognize body outlines or deform with poses. Consistent canvas dimensions and body placement make alignment easier.
Test idle, walking, sleeping, falling and common special actions, as well as repeated use and restoration after restarting. above_main cannot put part of one accessory in front and another part behind. For highly variable poses, consider drawing the appearance into the character animations instead.
文档持续完善中。 查看原始开发文档 ↗