BWIKI 全站将于 9 月 3 日(全天)进行维护,期间无法编辑任何页面或发布新的评论。
模组:节日数据
← 目录
此页面解释游戏如何存储和使用节日数据。这是面向模组开发者的高级指南。
数据文件
每个节日都有一个位于 Content/Data/Festivals/<season><day of month> 的数据文件。游戏使用此素材以决定当日是否有节日(若存在对应素材)、节日时间地点和 NPC 位置/对话/行为。
原始数据
节日数据可以解包以编辑。例如,如下是 1.5.4 版本的 Content/Data/Festivals/fall27 原始数据,以供参考:
Data
{
"name": "Spirit's Eve",
"conditions": "Town/2200 2350",
"shop": "BO 113 5000 1 O 746 750 5 BL 746 2000 1 BO 47 350 -1 F 2870 4000 -1",
"set-up": "spirits_eve/-1000 -1000/farmer 12 54 1/changeToTemporaryMap Town-Halloween/loadActors Set-Up/advancedMove Maru true 0 2 2 0 0 3 -11 0 0 -7 5 0 0 2 4 0/advancedMove Alex true -4 0 4 4000 4 0 4 5000/advancedMove Jas true 1 1500 4 1000/advancedMove Pam true 0 1 1 5000 0 -1 1 5000/advancedMove Shane true -7 0 0 2 2 9000 0 -2 7 0 4 9000/advancedMove Demetrius true 3 18000 4 3000/addTemporaryActor Skeleton 16 32 30 59 2 false Monster/advancedMove Skeleton true 0 1 3 4000 2 0 0 -1 4 2000 -1 0 3 1000 2 2000 0 -1 4 4000 -1 0 0 1 2 5000/addTemporaryActor Skeleton 16 32 35 58 2 false Monster/playerControl halloween",
"Abigail_spouse": "You'll have to tell me what's beyond, I can't go on... spiders...$s",
"Leah_spouse": "I may have had a little too much pumpkin ale...",
"Maru_spouse": "I'm confused... you go on ahead and let me figure this out.",
"Penny_spouse": "Oh... These vapors... Hmmm... You look nice tonight.$l",
"Haley_spouse": "I get scared easily... I think I'm just going to stay right here.$s",
"Sebastian_spouse": "It would be interesting to have one of these on the farm.",
"Sam_spouse": "Hey, I was wondering when you'd show up!$h",
"Harvey_spouse": "Hi... I was hoping you'd find me here...$l",
"Elliott_spouse": "Mmph... I believe I've eaten a few too many slices of pumpkin pie.",
"Abigail": "I can't go on... spiders...$s",
"Robin": "Well, winter's almost here. It's a great time to stockpile wood and stone.",
"Demetrius": "I haven't seen Maru in hours... I hope she's alright.",
"Maru": "I think I've already been this way... no, wait...$s#$e#I'm lost...$s",
"Sebastian": "I have no idea how these skeletons are walking... creepy.#$e#It's pretty cool though.",
"Pierre": "??",
"Caroline": "I get scared very easily. I'll leave the haunted maze to the younger people.",
"Linus": "Good show, old friend.",
"Alex": "There's something weird over there. But how do I get to it?#$e#There's gotta be a secret passage somewhere around here.",
"George": "Hmm... smoked turkey haunch? I guess this festival isn't all bad.$h",
"Evelyn": "I wish Gus would include a vegetarian option. Some zucchini skewers, maybe?",
"Lewis": "Good evening, @. Have you ventured into the haunted maze yet? It's quite spooky.#$e#That strange man who lives in the tower set it all up himself. He wouldn't let anyone near while he was working on it.",
"Clint": "One of my iridium-infused maces would make quick work of these things.",
"Emily": "Do you like the jack-o-lanterns? I carved them myself.",
"Penny": "The vapor from this cauldron... it's making my head spin, but I can't seem to leave...$u",
"Pam": "I'll come to any event with free grub! You won't see me in the haunted maze, though.",
"Haley": "Eek! I'm too scared.$s",
"Jodi": "Vincent's upset that I won't let him go into the haunted maze... but he's just a little boy!",
"Kent": "Hey, @. Nice evening, isn't it?",
"Sam": "That's odd... It's just a dead end up ahead.#$e#I could've sworn there was someone ahead of me when I went through the maze, though. Where'd they go?",
"Leah": "Mm, hi. Sorry... mouth full of blackberries.",
"Marnie": "Hi, @. Have you had a productive fall?#$e#It's starting to get quite cold... crops won't hold out for much longer.",
"Elliott": "Why, hello @. It's chilly, isn't it?",
"Gus": "It's a lot of fun to cook with pumpkin. Such an interesting fruit.",
"Dwarf": "You say it's raining up above? *gasp*#$e#Rain... It's almost mythical to us. Some of us live our entire lives without ever experiencing it.",
"Wizard": "The affairs of mundane folk matter little to me, but the elementals like a chance to see you up close.#$e#It was for them that I created this silly maze.",
"Harvey": "Oh! You found me...$8#$b#The truth is, I got too scared so I came here to hide. Don't tell anyone.$s",
"Shane": "Why is there no more pumpkin ale?",
"Sandy": "I heard it's raining back home. Is that why you came here?$h#$e#I kind of miss the rain, actually...$s",
"Jas": "But Aunt Marnie! I wanna go in the maze! I'm not scared!$s",
"Vincent": "Mother won't let me go in the maze. *sob*$s",
"Marlon": "Don't get too close to the cage.",
"Leo": "%Leo's unblinking eyes are glued to the screen. You're unable to get his attention."
}
格式
字段键名 | 解释 |
---|---|
name | 节日名称。用于显示文本,例如日历信息框或节日已开始的消息。 |
conditions | 节日的时间地点。格式为 <location> /<start time> <end time> ,其中 <location> 为内部地点名称,时间为 26 小时制(即,600 代表当日早 6 时,2600 代表次日凌晨 2 时)。
|
mainEvent | 主事件脚本。当玩家询问节日主持人(通常为刘易斯)时触发此脚本。对于不需要询问的事件或者与刘易斯对话不触发新场景的情形,应当省略此字段。 |
shop | 节日商店售卖的物品。参见下文商店格式。 |
set-up | 玩家第一次进入此节日触发的事件脚本。这包括将玩家传送到节日地图。此字段支持年变体。 |
Set-Up_additionalCharacters | 加载节日时生成的 NPC。这应当为四个由空格分隔的字段,形如 <NPC name> <tile X> <tile Y> <facing direction> ,而不同 NPC 之间用 / 分隔。其中 <facing direction> 取 up 或 0,down 或 2,left 或 3,以及 right 或 1。此属性会通过地图文件添加到生成的 NPC 上。例如,下面的代码会将阿比盖尔和莉亚并排放置,面朝下:"Set-Up_additionalCharacters": "Abigail 15 6 down/Leah 16 6 down"
|
MainEvent_additionalCharacters,或 Main-Event_additionalCharacters 以用于 冰雪节 |
此节日的 mainEvent 脚本运行时生成的 NPC。就像 mainEvent ,对于那些不需要询问是否要启动新场景的节日而言,此字段应当被忽略。此字段格式与上文的 Set-Up_additionalCharacters 相同。此字段支持年变体。 |
<NPC name> _roommate
|
指定 NPC 如果是玩家的室友,其与玩家交谈的对话台词。此字段支持年变体,不支持花舞节,不支持 #$e# 。若未指定,则下面将使用 <NPC name> _spouse。
|
<NPC name> _spouse
|
指定 NPC 如果是玩家的配偶,其与玩家交谈的对话台词。此字段支持年变体,不支持花舞节,不支持 #$e#。 |
<NPC name>
|
指定 NPC 与玩家交谈的对话台词,前提是 <NPC name> _spouse 不存在或未应用。此字段支持年变体。
|
另一个条目为节日期间过场动画的事件数据。在夏威夷宴会等情况下,这些都是相联系的。
年变体
某些字段允许使用年变体(见上表)。可以通过在键名末尾添加 _y<year variant>
来使用年变体,其中 <year variant>
为从 1 开始的逐次加 1 的、无上限的整数。例如,set-up_y1 和 set-up_y2 会交替出现(第 1 年 set-up_y1,第 2 年 set-up_y2,第 3 年 set-up_y1,以此类推)。若一个键存在年变体,则无年变体的原始版本会被忽略(例如,假如有形如 set-up_y* 的键,则永远不会使用 set-up)。
这些键对于节日数据而言是全局的,如果任何模组追加了年变体,则非变体键会失效,导致相应 NPC 无法生成。
商店格式
节日商店的每种物品都有空格分开的四个字段 <item type>
<item ID>
<cost>
<count available>
,并且此结构重复出现,以对应多个物品。字段格式:
字段 | 解释 |
---|---|
<item type>
|
物品类型。可用取值为 B 或 Boots(靴子)、BL 或 Blueprint(蓝图)、BBL、BBl 或 BigBlueprint(大型蓝图)、BO 或 BigObject (大型打造品)、F(家具)、H 或 Hat(帽子)、 O 或 Object(物体)、R 或 Ring(戒指)、W 或 Weapon(武器)。 |
<item id>
|
物品的贴图集索引。 |
<cost>
|
购买价格,单位为金。对于种子,这会基于利润率进行修改。 |
<count available>
|
一共能从商店购买多少物品。可设为 -1 代表无限。 |
地图
Many festivals use a separate map file located in the Content/Maps folder. The map to use is specified in the data file's set-up field using the changeToTemporaryMap command.
生成NPC
请考虑转而使用数据文件下的 Set-Up_additionalCharacters 字段。
可以通过在特定图层上使用地图地块索引来将NPC添加到节日中。这可以通过在数据文件的 set-up 字段中使用 loadActors <layer name>
命令来启用。对于图层上存在的每个地块,地块索引将映射到 Data\NPCDispositions 素材中 NPC 索引的 4 倍,同时有一个偏移量用于确定面向方向(0 = 向上,1 = 向右,2 = 向下,或 3 = 向左)。
例如,假设该图层有一个地块索引为61的地块。那么这就是 Data\NPCDispositions 中索引为 61 / 4 = 15 的NPC,即第16个NPC,也就是莉亚。偏移量是61 % 4 = 1,所以她面向右侧。当节日加载时,Leah将被添加到该地块位置,面向右侧。
硬编码逻辑
几个原版事件在游戏代码中有硬编码的脚本逻辑。例如,刘易斯在星露谷展览会上评价农夫的摊位是在游戏代码中处理的,而不是本文记录的内容素材。
夜市的处理方式也与其他节日不同。虽然有单独的夜市地图,但 NPC 数据并不存在于这些地图上。相反,NPC会通过日程数据动态地进入和离开节日。