“模组:编辑 XNB 文件”的版本间的差异
(复制自模组:制作一个XNB模组页面。) |
1059 Studio(讨论 | 贡献) |
||
第1行: | 第1行: | ||
←[[使用模组:目录|目录]] | ←[[使用模组:目录|目录]] | ||
− | |||
− | 本页 | + | 本页 描述了 如何 编辑 游戏文件以更改游戏 中的 数据 、 图像和地图。 |
==介绍== | ==介绍== | ||
− | ===XNB | + | === 什么是 XNB 文件?=== |
− | 游戏 | + | 游戏 将数据、地图和纹理 存储在 <tt>.xnb</tt> 这种 压缩 数据 文件 中,它们 在 游戏的 <tt>Content</tt> 文件夹中。 例如,对话 期间 显示的阿比盖尔的头像来自 这个文件: <tt>Content\Portraits\Abigail.xnb</tt> 。解包 这个文件 ,你会得到 <tt>Abigail.png</tt> 这 个图 片 文件 ,内容 如 下:<br />[[File:Modding - creating an XNB mod - example portraits.png]] |
− | < | + | (如果你使用 xnbcli 来解包,你通常会得到 <tt>Abigail.json</tt> 文件。 那只是用来打包回 <tt>.xnb</tt> 所需的文件,通常不需要更改它。) |
− | Abigail.xnb | ||
− | |||
− | |||
− | </ | ||
− | |||
− | |||
− | |||
− | |||
XNB模组代替了一些游戏原本的XNB文件,可以让你更改图像(头像,NPC行走图或建筑物外形),数据(作物信息或对话),或地图(包括地图行为,如传送或小游戏)。 XNB模组也可以添加全新的内容(如新的NPC)。 | XNB模组代替了一些游戏原本的XNB文件,可以让你更改图像(头像,NPC行走图或建筑物外形),数据(作物信息或对话),或地图(包括地图行为,如传送或小游戏)。 XNB模组也可以添加全新的内容(如新的NPC)。 |
2021年4月12日 (一) 08:41的版本
←目录
本页描述了如何编辑游戏文件以更改游戏中的数据、图像和地图。
介绍
什么是 XNB 文件?
游戏将数据、地图和纹理 存储在 .xnb 这种压缩数据文件中,它们在游戏的 Content 文件夹中。 例如,对话期间显示的阿比盖尔的头像来自这个文件: Content\Portraits\Abigail.xnb。解包这个文件,你会得到 Abigail.png 这个图片文件,内容如下:
(如果你使用 xnbcli 来解包,你通常会得到 Abigail.json 文件。 那只是用来打包回 .xnb 所需的文件,通常不需要更改它。)
XNB模组代替了一些游戏原本的XNB文件,可以让你更改图像(头像,NPC行走图或建筑物外形),数据(作物信息或对话),或地图(包括地图行为,如传送或小游戏)。 XNB模组也可以添加全新的内容(如新的NPC)。
XNB vs SMAPI mods
SMAPI is a modding API that lets you change the game using code. SMAPI mods are more powerful, easier to install and remove, and allow multiple mods to change the same content. On the other hand, SMAPI requires you to write code which some modders aren't comfortable with. If you have programming experience, creating a SMAPI mod is recommended instead if feasible.
有关这两种mod的更多信息,请看:使用模组:玩家常见问题。
在哪里可以获得帮助?
The Stardew Valley modding community is very welcoming. Feel free come chat on Discord or post in the forums.
入门
第一步
在你开始之前, 你应该安装这些:
- on Windows
- XNB Extract 0.2.2 去打开或者组装这个游戏的XNB 文件. (See forum post.)
- Paint.NET 去编辑图像文件(or use your favourite image editor).
- on Linux/Mac
- Wine 1.7 or later to run Windows programs like XNB Extract.
- XNB Extract 0.2.2 for Linux/Mac to unpack and pack the game's XNB files.
- GIMP to edit image files (or use your favourite image editor).
You should also back up your game's Content folder, so you can recover the original files if you make a mistake.
Unpack & pack game files
You can't edit an .xnb file itself, you need to edit the file that's inside it. Pulling out that inner file is called unpacking, and putting it back is called packing. Here's how to do it:
- Download XNB Extract (see #First-time setup).
- Unpack the file for editing:
- Find the file you want to edit in the Contents folder.
- Copy it into XNB Extract's Packed folder.
- Double-click UnpackFiles.bat (Windows) or UnpackFiles.sh (Linux/Mac).
- Edit the unpacked file (see below).
- Repack the file for the game:
- Double-click PackFiles.bat (Windows) or PackFiles.sh (Linux/Mac).
- Move the repacked .xnb file back to the original location.
Making changes
Spritesheets, tilesheets, or portraits
Definitions:
- A spritesheet is a PNG file containing small images in a regular grid pattern. Each square in the spritesheet's grid pattern is called a sprite. For example, each in-game item has a sprite in Content\Maps\spring_objects.xnb.
- A tilesheet is a synonym for spritesheet when used for map tiles. In a tilesheet, each square is called a tile and is 16×16 pixels.
- A portrait is a sprite from the Content\Characters\*.xnb spritesheets.
Spritesheets are easy to edit:
- Unpack the file you want to change.
- Open the unpacked .png file in an image editor (see #Getting started).
- Make changes directly to the image.
- Repack the file and copy it back to the original location.
That's it! You can launch the game to see your changes.
地图
请见:使用模组:地图