|
| 1 | +--- |
| 2 | +title: 战魂铭人 - 进阶模组教程2 |
| 3 | +published: 2025-06-02 |
| 4 | +description: 'Steam 版本战魂铭人的>>更加进阶版<<模组制作教程' |
| 5 | +image: './imgs/test.png' |
| 6 | +tags: [Game, OWL, Unity] |
| 7 | +category: Tutorial |
| 8 | +draft: false |
| 9 | +lang: zh # Set only if the post's language differs from the site's language in `config.ts` |
| 10 | +--- |
| 11 | + |
| 12 | +::github{repo="PapayaModding/Otherworld-Legends-Mod"} |
| 13 | + |
| 14 | +在阅读本教程前,请先学习[基础教程](/marblestack/posts/a_unity/a_owl/a1_basic_zh/)和[进阶教程](/marblestack/posts/a_unity/a_owl/b1_advanced_zh/)。 |
| 15 | + |
| 16 | +作者:Kolyn090 |
| 17 | + |
| 18 | +教程游戏版本:v2.10.0 |
| 19 | + |
| 20 | +使用Windows x64 |
| 21 | + |
| 22 | +教程日期:6/2/2025 |
| 23 | + |
| 24 | +本教程将指引你修改储存在SpriteAltas的图像。 |
| 25 | + |
| 26 | +<figure style="text-align:center;"> |
| 27 | + <img |
| 28 | + src="/marblestack/imgs/aa/c/test.png" |
| 29 | + width="300" |
| 30 | + style="display:block; margin: 0 auto;" |
| 31 | + alt="dotpict-interface" |
| 32 | + /> |
| 33 | + <figcaption style="font-size:0.85rem; color:#666; margin-top:0.4rem;"> |
| 34 | + (成果展示,沙包) |
| 35 | + </figcaption> |
| 36 | +</figure> |
| 37 | + |
| 38 | +如果你已经尝试使用在进阶教程中描述的方式修改除人物Sprite以外的大部分图像, |
| 39 | +你应该会发现该方法对其几乎不奏效。这是因为它们使用的是SpriteAltas打包方法。 |
| 40 | +其中很大一部分原因是因为文件的引用无法对号。 |
| 41 | + |
| 42 | +当你学会本教程以后,你应该可以修改大部分游戏图像而不受源图像大小限制。 |
| 43 | + |
| 44 | +:::important[警告] |
| 45 | +模组修改可能带来未知风险,包括游戏不稳定、存档损坏、兼容性问题,甚至安全漏洞。切记备份游戏文件,并谨慎操作。 |
| 46 | +风险自担——如果出现问题,我无法承担责任。 |
| 47 | +::: |
| 48 | + |
| 49 | +:::important[警告] |
| 50 | +该教程的操作流程非常复杂而且繁琐,请仔细阅读每一步。如果你遇到问题可以发issue提问。 |
| 51 | +::: |
| 52 | + |
| 53 | +### 步骤1️⃣ |
| 54 | +本教程将使用客厅中的沙包作为示例。(在我的电脑)它的文件位置为: |
| 55 | + |
| 56 | +```txt |
| 57 | +"C:\Program Files (x86)\Steam\steamapps\common\Otherworld Legends\Otherworld Legends_Data\StreamingAssets\aa\StandaloneWindows64\graphiceffecttextureseparatelygroup_assets_assets\sprites\unit\unit_other_pile.psd_0678876b821c494df01ee1384bec84f2.bundle" |
| 58 | +``` |
| 59 | + |
| 60 | +然后是要替换的图像: |
| 61 | + |
| 62 | +<figure style="text-align:center;"> |
| 63 | + <img |
| 64 | + src="/marblestack/imgs/aa/c/sactx-0-128x128-BC7-unit_other_pile-1aae59fd.png" |
| 65 | + width="300" |
| 66 | + style="display:block; margin: 0 auto;" |
| 67 | + alt="dotpict-interface" |
| 68 | + /> |
| 69 | + <figcaption style="font-size:0.85rem; color:#666; margin-top:0.4rem;"> |
| 70 | + Credit: https://www.spriters-resource.com/pc_computer/pizzatower/sheet/193192/ |
| 71 | + </figcaption> |
| 72 | +</figure> |
| 73 | + |
| 74 | +接着,打开进阶教程中的Unity项目。找到Texture2D。 |
| 75 | + |
| 76 | +<img |
| 77 | + src="/marblestack/imgs/aa/c/texture2d_folder.png" |
| 78 | + width="300" |
| 79 | + style="display:block; margin: 0 auto;" |
| 80 | + alt="texture2d_folder" |
| 81 | +/> |
| 82 | + |
| 83 | +我这里建议把之前关于天人道boss的教程放在另一个文件夹里。然后创建一个新的文件夹,比如叫 |
| 84 | +‘Other_Pile’。 |
| 85 | + |
| 86 | +把要替换的图像放在Other_Pile里。接着在Inspector修改它的参数。 |
| 87 | + |
| 88 | +请确保: |
| 89 | +1. Texture Type是Sprite(2D and UI) |
| 90 | +2. Sprite Mode是Multiple |
| 91 | +3. Mesh Type是Full Rect |
| 92 | +4. 关闭Generate Physics Shape |
| 93 | +5. 开启Read/Write |
| 94 | +6. Filter Mode是Point(no filter) |
| 95 | +7. Compression是None |
| 96 | +8. 点击Apply |
| 97 | + |
| 98 | +这次我们要手动修改Spritesheet(Slice Sprites)。点击Sprite Editor。 |
| 99 | + |
| 100 | +首先是沙包的底座。这里我们没有底座,所以直接找个空白的地方画框就行。 |
| 101 | +**一定要注意要取和示例里一样的名字。** |
| 102 | + |
| 103 | +<img |
| 104 | + src="/marblestack/imgs/aa/c/pilebase.png" |
| 105 | + width="300" |
| 106 | + style="display:block; margin: 0 auto;" |
| 107 | + alt="pilebase" |
| 108 | +/> |
| 109 | + |
| 110 | +然后是沙包的第一帧。我们这里在左边的雕像画框。切记把Pivot调成Bottom Center。 |
| 111 | +你也可以用Custom如果会的话。 |
| 112 | + |
| 113 | +<img |
| 114 | + src="/marblestack/imgs/aa/c/pile0.png" |
| 115 | + width="300" |
| 116 | + style="display:block; margin: 0 auto;" |
| 117 | + alt="pile0" |
| 118 | +/> |
| 119 | + |
| 120 | +接下来还有七帧,全部都画在右边的雕像。切记把Pivot调成Bottom Center。 |
| 121 | +取名见下方图像。 |
| 122 | +完成后点击Apply,你应该会看见和图片里一模一样的Sprites。 |
| 123 | + |
| 124 | +<img |
| 125 | + src="/marblestack/imgs/aa/c/pile_names.png" |
| 126 | + width="300" |
| 127 | + style="display:block; margin: 0 auto;" |
| 128 | + alt="pile_names" |
| 129 | +/> |
| 130 | + |
| 131 | +### 步骤2️⃣ |
| 132 | + |
| 133 | +在Unity的Project Settings里面,找到Sprite Packer-> Mode并调成 |
| 134 | +Sprite Atlas V1 - Always Enabled。 |
| 135 | + |
| 136 | +<img |
| 137 | + src="/marblestack/imgs/aa/c/proj-setting.png" |
| 138 | + width="300" |
| 139 | + style="display:block; margin: 0 auto;" |
| 140 | + alt="proj-setting" |
| 141 | +/> |
| 142 | + |
| 143 | +接着,在Texture2D里鼠标右键,找到并创建Sprite Atlas。 |
| 144 | +将其取名为‘unit_other_pile’ |
| 145 | + |
| 146 | +<img |
| 147 | + src="/marblestack/imgs/aa/c/create_atlas.png" |
| 148 | + width="300" |
| 149 | + style="display:block; margin: 0 auto;" |
| 150 | + alt="create_atlas" |
| 151 | +/> |
| 152 | + |
| 153 | +接着调它的参数。把Filter Mode调成Point。 |
| 154 | +Compression调成None。 |
| 155 | +然后把我们刚才切好的Sprites全部放到Packables中。 |
| 156 | +(⚠️ 似乎只能一个一个放,不过东西不多所以无伤大雅) |
| 157 | + |
| 158 | +然后就是最重要的,和之前一样,要把这个文件打包。 |
| 159 | +名字取 ‘sactx-0-128x128-bc7-unit-other-pile’。 |
| 160 | + |
| 161 | +<img |
| 162 | + src="/marblestack/imgs/aa/c/atlas_setting.png" |
| 163 | + width="300" |
| 164 | + style="display:block; margin: 0 auto;" |
| 165 | + alt="atlas_setting" |
| 166 | +/> |
| 167 | + |
| 168 | +对了,把之前的Texture2D也放里面。 |
| 169 | + |
| 170 | +<img |
| 171 | + src="/marblestack/imgs/aa/c/texture2d_pack.png" |
| 172 | + width="150" |
| 173 | + style="display:block; margin: 0 auto;" |
| 174 | + alt="texture2d_pack" |
| 175 | +/> |
| 176 | + |
| 177 | +然后运行‘Tools/Build Bundles’(上个教程给的代码)。 |
| 178 | +查看你是否有这个新的文件。 |
| 179 | + |
| 180 | +<img |
| 181 | + src="/marblestack/imgs/aa/c/check_assetbundles.png" |
| 182 | + width="300" |
| 183 | + style="display:block; margin: 0 auto;" |
| 184 | + alt="check_assetbundles" |
| 185 | +/> |
| 186 | + |
| 187 | +### 步骤3️⃣ |
| 188 | + |
| 189 | +接下来就是解决文件引用的问题了。这个部分可能有点难理解而且需要重复操作。 |
| 190 | +先来看我做的图。现在看不懂没关系,等你学完这个部分就会明白了。 |
| 191 | + |
| 192 | +<img |
| 193 | + src="/marblestack/imgs/aa/c/figma_diagram.png" |
| 194 | + width="300" |
| 195 | + style="display:block; margin: 0 auto;" |
| 196 | + alt="figma_diagram" |
| 197 | +/> |
| 198 | + |
| 199 | +Unity的Texture引用使用的是有符号整数(可负可正)。简单来说,你可以理解成ID。我们这一步就是要修改我们生成后的AssetBundle中的ID。这样游戏才能找得到这些资源。 |
| 200 | + |
| 201 | +具体操作: |
| 202 | + |
| 203 | +打开UABEA。打开我们刚刚打包好的AssetBundle |
| 204 | + |
| 205 | +<img |
| 206 | + src="/marblestack/imgs/aa/c/assetbundle_path.png" |
| 207 | + width="300" |
| 208 | + style="display:block; margin: 0 auto;" |
| 209 | + alt="assetbundle_path" |
| 210 | +/> |
| 211 | + |
| 212 | +选择所有 SpriteAtlas 和 Sprites 并Export Dump。 |
| 213 | +把它们放在Unity里面的 My Dump 文件夹。对了,我建议你把Dumps这个文件夹也像Texture2D文件夹一样先整理一下。这样对做多个模组会有很大的帮助。 |
| 214 | + |
| 215 | +<img |
| 216 | + src="/marblestack/imgs/aa/c/organize_dumps.png" |
| 217 | + width="300" |
| 218 | + style="display:block; margin: 0 auto;" |
| 219 | + alt="organize_dumps" |
| 220 | +/> |
| 221 | + |
| 222 | +我们这次其实用不到Game Dump和Source Dump,因为我们将手动更改这些Text Assets。 |
| 223 | + |
| 224 | +在任意文本编辑器打开这些文件,准备下一步。 |
| 225 | + |
| 226 | +--- |
| 227 | + |
| 228 | +打开一个新的UABEA窗口,从游戏文件中找到沙包的BUN文件并打开。 |
| 229 | +在我的电脑里,该文件位置为: |
| 230 | + |
| 231 | +```txt |
| 232 | +"C:\Program Files (x86)\Steam\steamapps\common\Otherworld Legends\Otherworld Legends_Data\StreamingAssets\aa\StandaloneWindows64\graphiceffecttextureseparatelygroup_assets_assets\sprites\unit\unit_other_pile.psd_0678876b821c494df01ee1384bec84f2.bundle" |
| 233 | +``` |
| 234 | + |
| 235 | +:::note |
| 236 | +现在我画的图就能派上用场了。首先你要明白<u>黑框中的图都是在UABEA中打开的,而黑框外面的都是 |
| 237 | +我们将在 My Dump 中的需要改动的。</u>看看你能不能找得到这些文件。 |
| 238 | +::: |
| 239 | + |
| 240 | +刚才我们Export Dump的时候包括了两种文件格式 - SpriteAtlas 和 Sprite。 |
| 241 | + |
| 242 | +1. 在SpriteAtlas这个文件的Dump里,找到`m_RenderDataMap/m_PathID`,并把它改为 |
| 243 | +和Main Texture一样的ID。(如果你看见了两个Texture2D,选不是sactx的那个) |
| 244 | + |
| 245 | +2. 在SpriteAtlas这个文件的Dump里,找到`m_PackedSprites`(注意这是个数组,你需要 |
| 246 | +改每一个Sprite)。把它的`m_PathID`改成对应Sprite文件的ID。(注意顺序很重要!这会决定图像的动画。) |
| 247 | +要如何知道顺序?请看`m_PackedSpriteNamesToIndex`这个地方,它其中`data`这个数是对应 |
| 248 | +Sprite的名字的,所以你的`m_PathID`要对应这些文件。 |
| 249 | + |
| 250 | +3. 现在改每一个Sprite的Dump文件。找到`m_SpriteAtlas/m_PathID`,把它改成 |
| 251 | +SpriteAtlas的ID(⚠️在目前UABEA上显示的)。 |
| 252 | + |
| 253 | +完成了这些以后,My Dump中的文件就可以完美替换源游戏文件了。 |
| 254 | + |
| 255 | +### 步骤4️⃣ |
| 256 | + |
| 257 | +接下来就和我们以前做的很像了。在UABEA里,你目前打开的就是源游戏文件所以不用打开新的。 |
| 258 | +然后做以下步骤: |
| 259 | +1. 把sactx...这个Texture2D文件用Plugins -> Edit Texture换成Unity Texture2D里面的雕像图像。 |
| 260 | +2. 用Import Dump,把SpriteAtlas文件的Dump换成我们之前修改过的。 |
| 261 | +3. 用Import Dump,把所有Sprite文件的Dump换成我们之前修改过的。 |
| 262 | + |
| 263 | +现在我们还有一件很重要的事要完成。 |
| 264 | +用AssetStudio,打开我们的Bundle文件。然后找到开头为‘sactx’的Texture2D文件。 |
| 265 | +Export -> Selected Assets, 保存到Texture2D文件夹里。 |
| 266 | + |
| 267 | +<img |
| 268 | + src="/marblestack/imgs/aa/c/save_atlas.png" |
| 269 | + width="300" |
| 270 | + style="display:block; margin: 0 auto;" |
| 271 | + alt="save_atlas" |
| 272 | +/> |
| 273 | + |
| 274 | +打开UABEA,再打开游戏文件中沙包的BUN文件。用Plugins -> Edit Texture替换Main Texture(**不是sactx开头的那个**)Texture2D文件。 |
| 275 | + |
| 276 | +做完这些后运行一下基础教程的步骤五(addrtool)就大功告成了。 |
| 277 | + |
| 278 | +<img |
| 279 | + src="/marblestack/imgs/aa/c/test.png" |
| 280 | + width="300" |
| 281 | + style="display:block; margin: 0 auto;" |
| 282 | + alt="test" |
| 283 | +/> |
| 284 | + |
| 285 | +--- |
| 286 | + |
| 287 | +本教程由Kolyn090(bilibili:木瓜凝乳蛋白酶)撰写。 |
| 288 | + |
| 289 | +<br> |
| 290 | +<br> |
| 291 | + |
| 292 | +💗 如果你觉得这个教程对你有帮助,可以 follow [我的 GitHub 账号](https://github.com/Kolyn090/)吗?非常感谢! |
| 293 | + |
| 294 | +<br> |
| 295 | +<br> |
| 296 | + |
| 297 | +👾 Happy Gaming 👾 |
0 commit comments