第1行: |
第1行: |
− | ← {{ 模组:目录|目录}} | + | ← [[ 模组:目录|目录]] |
− | | |
− | {{翻译}}
| |
| | | |
| 想为游戏创建内容包模组吗?教程就在这里。'''有关如何使用模组,请参阅 [[模组:使用指南/入门]] | | 想为游戏创建内容包模组吗?教程就在这里。'''有关如何使用模组,请参阅 [[模组:使用指南/入门]] |
第15行: |
第13行: |
| * 制作季节性的变化 | | * 制作季节性的变化 |
| * 根据天气、日期、与其他 NPC 的关系等进行更改 | | * 根据天气、日期、与其他 NPC 的关系等进行更改 |
− | * 进行非常具体的更改(例如,在完 成乔家 超市献祭之后,在下雪的冬天的周末,咖啡价格会更高) | + | * 进行非常具体的更改(例如,在完 成Joja 超市献祭之后,在下雪的冬天的周末,咖啡价格会更高) |
| * 以及更多 | | * 以及更多 |
| | | |
| ===资源 Assets=== | | ===资源 Assets=== |
− | 一个 '''asset''' 本质上是游戏中的 <tt>Content</tt> 文件夹,具有唯一的“资源名称”。 资产名称从不包含 <tt>Content</tt>路径、语言或文件扩展名(可以使用令牌来定位特定的语言)。例如: | + | 一个 '''asset''' 本质上是游戏中的 <samp>Content</samp> 文件夹,具有唯一的“资源名称”。 资产名称从不包含 <samp>Content</samp>路径、语言或文件扩展名(可以使用令牌来定位特定的语言)。例如: |
| | | |
− | {| class="wikitable" | + | {|class="wikitable" |
| |- | | |- |
| ! 文件 | | ! 文件 |
| ! 资源名称 | | ! 资源名称 |
| |- | | |- |
− | | <tt>Content/Portraits/Abigail.xnb</tt> | + | | <samp>Content/Portraits/Abigail.xnb</samp> |
− | | <tt>Portraits/Abigail</tt> | + | | <samp>Portraits/Abigail</samp> |
| |- | | |- |
− | | <tt>Content/Maps/spring_beach.xnb</tt><br /><tt>Content/Maps/spring_beach.es-ES.xnb</tt><br /><tt>Content/Maps/spring_beach.fr-FR.xnb</tt> | + | | <samp>Content/Maps/spring_beach.xnb</samp><br /><samp>Content/Maps/spring_beach.es-ES.xnb</samp><br /><samp>Content/Maps/spring_beach.fr-FR.xnb</samp> |
− | | <tt>Maps/spring_beach</tt> | + | | <samp>Maps/spring_beach</samp> |
| |} | | |} |
| | | |
− | 一个资源可能包含多个子画面或数据条目。例如:<tt>Portraits/Abigail</tt>: | + | 一个资源可能包含多个子画面或数据条目。例如:<samp>Portraits/Abigail</samp>: |
| | | |
| [[File:Modding - creating an XNB mod - example portraits.png]] | | [[File:Modding - creating an XNB mod - example portraits.png]] |
| | | |
− | 因此,如果想更改阿比盖尔的肖像,则可以使用 Content Patcher 加载或编辑 <tt>Portraits/Abigail</tt>. | + | 因此,如果想更改阿比盖尔的肖像,则可以使用 Content Patcher 加载或编辑 <samp>Portraits/Abigail</samp>. |
| | | |
| ===Load 和 Edit=== | | ===Load 和 Edit=== |
| 可以通过两种概念上的方式来更改资源: | | 可以通过两种概念上的方式来更改资源: |
| | | |
− | * ''Load'' the initial version of an asset. Each asset can only be loaded by one mod at the same time. This is mainly useful for total replacement mods (like a mod that completely changes an NPC's portraits), or to provide files that don't exist in the <tt>Content</tt> folder. | + | * ''Load|加载'' Asset的初始版本。 每个Asset只能同时被一个模组加载。 这主要用于完全替换模组(例如完全改变 NPC 肖像的模组),或提供 <samp>Content</samp> 文件夹中不存在的文件。 |
− | * ''Edit'' an asset after it's loaded. Any number of edits can be applied to the same asset. | + | * ''Edit|编辑'' 加载后的Asset。 可以对同一资产应用任意数量的编辑。 |
| | | |
− | For example, let's say the game needs Abigail's portraits. This is how changes are applied:
| + | 例如,假设游戏需要阿比盖尔的肖像。 这是应用更改的方式: |
| <pre> | | <pre> |
| ┌────────────┐ | | ┌────────────┐ |
− | │ edit asset │ | + | │ 编辑Asset │ |
| ┌────────────┐ ├────────────┤ | | ┌────────────┐ ├────────────┤ |
− | get Portraits/Abigail ──>│ load asset │───>│ edit asset │──> portrait asset
| + | 获得肖像/ 阿比盖尔 ──>│ 载入Aeest │───>│ 编辑Asset │──> 肖像Aeest |
| └────────────┘ ├────────────┤ | | └────────────┘ ├────────────┤ |
− | │ edit asset │ | + | │ 编辑Asset │ |
| └────────────┘ | | └────────────┘ |
| </pre> | | </pre> |
| | | |
− | This is divided into four main action types (<tt>Load</tt>, <tt>EditData</tt>, <tt>EditImage</tt>, <tt>EditMap</tt>), which are explained in more detail in the Content Patcher readme (see below).
| + | 这分为四种主要操作类型(<samp>Load</samp> 、<samp>EditData</samp> 、<samp>EditImage</samp> 、<samp>EditMap</samp> ),在 内容修补程序自述文件中的更多详细信息(见下文)。 |
| | | |
− | ==Get started== | + | == 开始== |
− | ===Intro to JSON=== | + | === 了解Json=== |
− | You'll notice a lot of files with <tt>.json</tt> at the end of the name when creating mods for Stardew Valley. That means they're formatted as JSON, which is just a way of writing text that's readable to code. If you haven't used JSON before, reading ''[https://towardsdatascience.com/an-introduction-to-json-c9acb464f43e An Introduction to JSON]'' first will be very helpful to understand what the files are doing.
| + | 在为 Stardew Valley 创建 mod 时,您会注意到很多文件的名称末尾带有 <samp>.json</samp> 。 这意味着它们被格式化为 JSON ,这只是一种编写代码可读的文本的方式。 如果您以前没有使用过 JSON ,请阅读 ''[https://towardsdatascience.com/an-introduction-to-json-c9acb464f43e An Introduction to JSON]'' 会助于了解文件在做什么。 |
| | | |
− | ===Create example mod=== | + | === 创建示例模块=== |
− | First let's get our basic content pack up and running:
| + | 首先让我们安装并运行我们的基本内容: |
| <ol> | | <ol> |
− | <li>Install [https://smapi.io/ SMAPI] and {{nexus mod|1915|Content Patcher}}.</li> | + | <li> 安装 [https://smapi.io/ SMAPI] 和 {{nexus mod|1915|Content Patcher}}.</li> |
− | <li>Unpack the game's <tt>Content</tt> folder so you can see what each asset contains (see [[Modding:Editing XNB files#Unpack game files]]).</li> | + | <li> 解压游戏的<samp>Content</samp> 文件夹,这样您就可以看到每个资产包含的内容。</li> |
− | <li>[[Modding:Content packs#Create a content pack|Create a SMAPI content pack]].</li> | + | <li> 修改或创建SMAPI内容包。</li> |
− | <li>Create a <tt>content.json</tt> file in the same folder with this content: | + | <li> 使用以下内容在同一文件夹中创建一个 <samp>content.json</samp> 文件: |
| {{#tag:syntaxhighlight| | | {{#tag:syntaxhighlight| |
| { | | { |
第76行: |
第74行: |
| }|lang=javascript}} | | }|lang=javascript}} |
| </li> | | </li> |
− | <li>Launch the game.</li> | + | <li> 启动游戏。</li> |
| </ol> | | </ol> |
| | | |
− | If you did everything correctly so far, you should see the new mod under "Loaded X content packs" in the SMAPI console. (If not, review the above steps or [[Modding:Community|ask for help]].)
| + | 如果到目前为止你做的一切都正确,你应该在 SMAPI 控制台的“加载的 X 内容包”下看到新的 mod 。 (如果没有,请查看上述步骤或 [[Modding:Community| 寻求帮助]] 。) |
| | | |
− | ===Content format=== | + | === 内容格式=== |
− | The <tt>content.json</tt> file you created above is what tells Content Patcher what to change. This has two main fields:
| + | 您在上面创建的 <samp>content.json</samp> 文件告诉 Content Patcher 要更改什么。 这有两个主要领域: |
| | | |
− | * <tt>Format</tt>: the format version. You should always use the latest version (currently 1.19.0) to enable the latest features and avoid obsolete behavior. | + | * <samp>Format</samp> :格式版本。 您应该始终使用最新版本(当前为 1.19.0 )来启用最新功能并避免过时行为。 |
− | * <tt>Changes</tt>: the changes you want to make. Each entry is called a ''patch'', and describes a specific action to perform: replace this file, copy this image into the file, etc. You can list any number of patches. | + | * <samp>Changes</samp> :您要进行的更改。 每个条目称为“补丁”,并描述要执行的特定操作:替换此文件、将此图像复制到文件中等。您可以列出任意数量的补丁。 |
| | | |
− | You can list any number of patches in the <tt>Changes</tt> field, each surrounded by <code>{</code> and <code>}</code>. See the next section for more info, but here's a quick example:
| + | 您可以在 <samp>Changes</samp> 字段中列出任意数量的补丁,每个补丁都由 <code>{</code> 和 <code>}</code> 包围。 有关更多信息,请参阅下一节,但这里有一个快速示例: |
| {{#tag:syntaxhighlight| | | {{#tag:syntaxhighlight| |
| { | | { |
第106行: |
第104行: |
| }|lang=javascript}} | | }|lang=javascript}} |
| | | |
− | (There are other fields like <tt>ConfigSchema</tt> and <tt>DynamicTokens</tt> for more advanced usage; these are covered in the full readme.)
| + | (还有其他字段,如 <samp>ConfigSchema</samp> 和 <samp>DynamicTokens</samp> 用于更高级的用法;这些都包含在完整的自述文件中。) |
| | | |
− | ==Next steps== | + | == 下一步== |
− | You've created a Content Patcher pack! <!--Next we'll make it do something. This tutorial will walk you through creating Blueberries Everywhere, a mod which just turns various things into blueberries.
| + | 您已经创建了一个内容补丁包! <!-- 接下来我们将让它做一些事情。 本教程将引导您创建无处不在的蓝莓,这是一个将各种东西变成蓝莓的 mod 。 |
| | | |
− | When you're ready to continue, see the navigation at the bottom of the page to continue.-->
| + | 当您准备好继续时,请查看页面底部的导航以继续。--> |
| | | |
− | For help making it do something, see...
| + | 如需帮助使其做某事,请参阅... |
− | * [https://github.com/Pathoschild/StardewMods/tree/develop/ContentPatcher#readme Content Patcher readme] for the full reference; | + | * [https://github.com/Pathoschild/StardewMods/tree/develop/ContentPatcher#readme Content Patcher readme] 供完整参考; |
− | * [https://www.youtube.com/watch?v=uqRTgjWvDYs video intro to Content Patcher] (unofficial); | + | * [https://www.youtube.com/watch?v=uqRTgjWvDYs video intro to Content Patcher] ( 非官方); |
− | * [https://docs.google.com/presentation/d/1OBIJSNOwEA2sdBzNbUiVUQni-ajABGFmL-FUanhuLvk intro to converting XNB mods] (unofficial). | + | * [https://docs.google.com/presentation/d/1OBIJSNOwEA2sdBzNbUiVUQni-ajABGFmL-FUanhuLvk intro to converting XNB mods] ( 非官方). |
| | | |
− | ==Examples== | + | == 例子== |
− | (We'll have a guided tutorial here soon.)
| + | (很快就会在这里提供指导教程。) |
| | | |
− | ===Change horse/pet icons=== | + | === 改变马/ 宠物图标=== |
− | For edits to replace the look of horses and/or pets (cats and dogs), you can add these to your content.json in order to also replace the little head icon in the inventory menu:
| + | 对于替换马和/ 或宠物(猫和狗)外观的编辑,您可以将这些添加到您的 content.json 中,以便也替换库存菜单中的头像图标: |
| | | |
− | For horses:
| + | 马: |
| <syntaxhighlight lang="javascript"> | | <syntaxhighlight lang="javascript"> |
| //horse head in inventory | | //horse head in inventory |
第136行: |
第134行: |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
− | For dogs:
| + | 狗: |
| <syntaxhighlight lang="javascript"> | | <syntaxhighlight lang="javascript"> |
| //dog head in inventory | | //dog head in inventory |
第148行: |
第146行: |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |
− | For cats:
| + | 猫: |
| <syntaxhighlight lang="javascript"> | | <syntaxhighlight lang="javascript"> |
| //cat head in inventory | | //cat head in inventory |
第166行: |
第164行: |
| }} | | }} |
| --> | | --> |
| + | |
| + | [[Category:模组]] |
| | | |
| [[en:Modding:Content Patcher]] | | [[en:Modding:Content Patcher]] |