Help:Adding items: Difference between revisions

Jump to navigation Jump to search
Formatting changes, save game data section, inventory icon section, installing section
imported>Ginger
(Added steps for dyeables, improved formatting, added a couple pictures)
imported>Ginger
(Formatting changes, save game data section, inventory icon section, installing section)
Line 18: Line 18:
'''Do not skip this section, it is very important.'''
'''Do not skip this section, it is very important.'''


This tutorial will use several terms that you may not be familiar with, or will have specific definitions you may not immediately know:
This tutorial will use several terms that you may not be familiar with, or will have specific definitions you may not have used before:


* File name (or FileName) - the name of a file. For example, for the file <code>Armor_001.sbfres</code>, the FileName is <code>Armor_001</code>
* File name (or FileName) - the name of a file. For example, for the file <code>Armor_001.sbfres</code>, the FileName is <code>Armor_001</code>
* File extension (or FileExtension) - the type/extension of a file. For example, for the file <code>Armor_001.sbfres</code>, the FileExtension is <code>sbfres</code>
* File extension (or FileExtension) - the type/extension of a file. For example, for the file <code>Armor_001.sbfres</code>, the FileExtension is <code>sbfres</code>
* Actor name (or ActorName) - the code name of the item, and the FileName of the actor pack. For example, the Hylian Tunic is <code>Armor_001_Upper</code>.
* Actor name (or ActorName) - the code name of the item, and the FileName of the actor pack. For example, the Hylian Tunic is <code>Armor_001_Upper</code>.
* <code>bfres</code> name (or BfresName) - the code name of the resource files containing the model and texture data for the actor, and the FileName of the <code>bfres</code> for an actor. For example, the Hylian Tunic is part of the Hylian Set and all Hylian Set resources are contained inside <code>Armor_001</code>. In general, an armor's BfresName is the first two parts of its ActorName (<code>Armor_001</code> out of <code>Armor_001_Upper</code>). This tutorial uses <code>sbfres</code> and <code>bfres</code> interchangeably. They are different, but the tools we use can let us treat them the same, so, for the purpose of this tutorial, there is no meaningful difference between them.
* <code>bfres</code> name (or BfresName) - the code name of the resource files containing the model and texture data for the actor, and the FileName of the <code>bfres</code> for an actor. For example, the Hylian Tunic is part of the Hylian Set and all Hylian Set resources are contained inside <code>Armor_001</code>. In general, an armor's BfresName is the first two parts of its ActorName (e.g. <code>Armor_001</code> out of <code>Armor_001_Upper</code>). This tutorial uses <code>sbfres</code> and <code>bfres</code> mostly interchangeably, but you can think of an <code>sbfres</code> as a ZIP archive that contains a <code>bfres</code>.  
* Model name (or ModelName) - the code name of the model inside the resource files to be used. In almost all cases, this is the same as the ActorName. The only exceptions to this are for armor models that have a mantle variant, like <code>Armor_001</code>. Their ActorName will end in <code>_Head</code>, and their ModelName will end in <code>_Head_A</code>.
* Model name (or ModelName) - the code name of the model inside the resource files to be used. In almost all cases, this is the same as the ActorName. The only exceptions to this are for head armor models that have a mantle variant, like <code>Armor_001</code>. Their ActorName will end in <code>_Head</code>, and their ModelName will end in <code>_Head_A</code>.
* Old - if something is referred to as "old," that means any files you are using as the base files for your new item. For example, if you are creating a new shield that performs similarly to <code>Weapon_Shield_001</code> (is a shield, is wooden, etc.) and you were copying its files to your mod, then <code>Weapon_Shield_001</code> would be the "old" actor name.
* Old - if something is referred to as "old," that means any files you are using as the base files for your new item. For example, if you are creating a new shield that performs similarly to <code>Weapon_Shield_001</code> (is a shield, is wooden, etc.) and you were copying its files to your mod, then <code>Weapon_Shield_001</code> would be the "old" actor name.
* New - anything that refers to the new item you are making. If something is not referred to as "old" or "new," then it is new. For example, if you are making <code>Armor_9001_Head</code> then that is both the NewActorName and the ActorName.
* New - anything that refers to the new item you are making. If something is not referred to as "old" or "new," then it is new. For example, if you are making <code>Armor_9001_Head</code> then that will be referred to as either the NewActorName and the ActorName.


Vanilla weapons have the same name as their actor, model, and <code>bfres</code> names. For example, the actor <code>Weapon_Sword_001</code> has the model name <code>Weapon_Sword_001</code> and its resource files are in <code>Weapon_Sword_001.sbfres</code>.
Vanilla weapons have the same name as their actor, model, and <code>bfres</code> names. For example, the actor <code>Weapon_Sword_001</code> has the model name <code>Weapon_Sword_001</code> and its resource files are in <code>Weapon_Sword_001.sbfres</code>.
Line 66: Line 66:
Once you've got the actor files opened in the editor you want, there will be certain parts of the files that you need to change. All instances of the old actor, model, and BFRES names will need to be changed to the new actor, model, and BFRES names. The following is a list of many of the changes that need to be made, but note that some of these may not apply to your item, and there are some changes that may not appear in this list. Be thorough when you look through the files for things that may need to be changed.
Once you've got the actor files opened in the editor you want, there will be certain parts of the files that you need to change. All instances of the old actor, model, and BFRES names will need to be changed to the new actor, model, and BFRES names. The following is a list of many of the changes that need to be made, but note that some of these may not apply to your item, and there are some changes that may not appear in this list. Be thorough when you look through the files for things that may need to be changed.


* [[File:Addingitems aampfilenames.png|alt=Actor pack file name changes|thumb|The underlined items need to be changed for this actor pack (in addition to the actor pack name)]]File/Folder names:
* [[File:Addingitems_aampfilenames.png|alt=Actor pack file name changes|thumb|The underlined items need to be changed for this actor pack (in addition to the actor pack name and the contents of each file)]]File/Folder names:
** changing the name of the <code>[ActorName].bmodellist</code> file inside <code>Actor/ModelList</code>
** changing the name of the <code>[ActorName].bmodellist</code> file inside <code>Actor/ModelList</code>
** changing the name of the <code>[ModelName].bphysics</code> file inside <code>Actor/Physics</code>
** changing the name of the <code>[ModelName].bphysics</code> file inside <code>Actor/Physics</code>
Line 76: Line 76:
** changing the name of the <code>[ModelName].hkcl</code> file inside <code>Physics/Cloth/[BfresName]</code>
** changing the name of the <code>[ModelName].hkcl</code> file inside <code>Physics/Cloth/[BfresName]</code>
* Inside <code>bmodellist</code>:
* Inside <code>bmodellist</code>:
** changing the line that says <code>Folder: !str64 [BfresName]</code> to the new BFRES name
** changing the line that says <code>Folder: !str64 [BfresName]</code> to the new <code>bfres</code> name
** changing the line that says <code>UnitName: !str64 [modelName]</code> to the new model name
** changing the line that says <code>UnitName: !str64 [modelName]</code> to the new model name
* Inside <code>bphysics</code>:
* Inside <code>bphysics</code>:
Line 87: Line 87:
** changing the line that says <code>ModelUser: !strRef [ActorName]</code> to the new actor name
** changing the line that says <code>ModelUser: !strRef [ActorName]</code> to the new actor name
** changing the line that says <code>PhysicsUser: !StrRef [ModelName]</code> to the new model name
** changing the line that says <code>PhysicsUser: !StrRef [ModelName]</code> to the new model name
* Inside <code>bgparamlist</code>:
* [[File:Addingitems bgparamlist.jpg|thumb|Example of two parameters commonly changed, inside the bgparamlist file.]]Inside <code>bgparamlist</code>:
** If your armor is upgradeable, changing the line that says <code>NextRankName: [ActorName]</code> to the actor name for the actor that this one upgrades into. (In game terms, "upgradeable" means via the Great Fairies)
** If your armor is upgradeable, changing the line that says <code>NextRankName: [ActorName]</code> to the actor name for the actor that this one upgrades into. (In game terms, "upgradeable" means via the Great Fairies)
** The <code>bgparamlist</code> file also contains most of the information about the stats of items. For example, a weapon/shield's durability, a weapon's damage, a shield's block rate, an armor's defense, an armor's set (and therefore set bonus) are all stored here. You may want to change some of these things. A comprehensive list of the things inside the <code>bgparamlist</code> file is available [[Bgparamlist|here]].
** The <code>bgparamlist</code> file also contains most of the information about the stats of items. For example, a weapon/shield's durability, a weapon's damage, a shield's block rate, an armor's defense, an armor's set (and therefore set bonus) are all stored here. You may want to change some of these things. A comprehensive list of the things inside the <code>bgparamlist</code> file is available [[Bgparamlist|here]]. Commonly changed parameters include: <code>Life</code> (the durability of the item, in the <code>General</code> category), <code>Power</code> (a weapons' damage, in the <code>Attack</code> category), <code>DefenceAddLevel</code> (an armor's defense rating, in the <code>Armor</code> category).


Once you've made your changes, '''make sure to save'''.
Once you've made your changes, '''make sure to save'''.
Line 137: Line 137:
This section will cover the files that actually tell the game what the 3D model of the item looks like, in game. You'll need to copy the resources for the original item that you're modifying to your mod's <code>content\Model</code> folder. You will find the original resource files in your dumped UPDATE files (not the base game files), in the same location. (<code>content\Model</code>) The files will be called <code>[OldBfresName].sbfres</code> and <code>[OldBfresName].Tex.sbfres</code>. '''If you are modding for WiiU or Cemu, there are actually three files you will need: <code>[OldBfresName].sbfres</code>, <code>[OldBfresName].Tex1.sbfres</code>, and <code>[OldBfresName].Tex2.sbfres</code>. If <code>[OldBfresName].Tex1.sbfres</code> is not present in your UPDATE files, you will need to find it in your BASE GAME dumped files. This is the case for most, if not all, vanilla (non-DLC) items.'''
This section will cover the files that actually tell the game what the 3D model of the item looks like, in game. You'll need to copy the resources for the original item that you're modifying to your mod's <code>content\Model</code> folder. You will find the original resource files in your dumped UPDATE files (not the base game files), in the same location. (<code>content\Model</code>) The files will be called <code>[OldBfresName].sbfres</code> and <code>[OldBfresName].Tex.sbfres</code>. '''If you are modding for WiiU or Cemu, there are actually three files you will need: <code>[OldBfresName].sbfres</code>, <code>[OldBfresName].Tex1.sbfres</code>, and <code>[OldBfresName].Tex2.sbfres</code>. If <code>[OldBfresName].Tex1.sbfres</code> is not present in your UPDATE files, you will need to find it in your BASE GAME dumped files. This is the case for most, if not all, vanilla (non-DLC) items.'''


Once you have copied the old files to the new location, you will rename them to your new BFRES name. Note that this name needs to match the BFRES name you used when editing the actor pack files.
Once you have copied the old files to the new location, you will rename them to your new <code>bfres</code> name. Note that this name needs to match the <code>bfres</code> name you used when editing the actor pack files.


The bulk of the [[Help:Replacing models|model replacement]] and [[Help:Replacing textures|texture replacement]] is explained in other tutorials. Once you've used those tutorials to replace the bulk of the data, we can change the names that BotW uses to refer to that data. All the rest of this section assumes that you have both sbfres files for your actor open in Switch Toolbox.
The bulk of the [[Help:Replacing models|model replacement]] and [[Help:Replacing textures|texture replacement]] is explained in other tutorials. Once you've used those tutorials to replace the bulk of the data, we can change the names that BotW uses to refer to that data. All the rest of this section assumes that you have both <code>sbfres</code> files for your actor open in Switch Toolbox. (If on WiiU, you don't need to open the Tex2 file. Switch Toolbox will read its data whenever you open the Tex1 file, as long as they are in the same folder.)


The first thing to change is the <code>bfres</code> name. This does not happen automatically when you change the <code>sbfres</code> name. You can do this by right-clicking on the orange file labeled "FRES" on the left side and selecting Rename.
Some important terms in modeling:
A "model" is the 3D data for a whole actor. The models are everything that is inside the <code>Models</code> folder of the <code>[BfresName].sbfres</code> file.
A "model" is the 3D data for a whole actor. The models are everything that is inside the <code>Models</code> folder of the <code>[BfresName].sbfres</code> file.
An "object" is the 3D data for a piece of an actor. The objects are everything that is inside the <code>Models\[ModelName]\Objects</code> folder.
An "object" is the 3D data for a piece of an actor. The objects are everything that is inside the <code>Models\[ModelName]\Objects</code> folder.
A single model will be made up of one or more objects.
A "material" is the data the game uses to "paint" a model, so that it knows what color it is, how it reflects light, whether or not it's shiny or dull, etc. The materials are everything that is inside the <code>Models\[ModelName]\Materials</code> folder.
A "material" is the data the game uses to "paint" a model, so that it knows what color it is, how it reflects light, whether or not it's shiny or dull, etc. The materials are everything that is inside the <code>Models\[ModelName]\Materials</code> folder.
A "texture" (or "map") is a single picture that contains color, light reflection, metallic, or other data for a material. Textures are contained separately, in the <code>[BfresName].Tex.sbfres</code> file. (<code>[BfresName].Tex1.sbfres</code> for WiiU/Cemu)
A "texture" (or "map") is a single picture that contains color, light reflection, metallic, or other data for a material. Textures are contained separately, in the <code>[BfresName].Tex.sbfres</code> file. (<code>[BfresName].Tex1.sbfres</code> for WiiU/Cemu)
Line 153: Line 157:
When changing the names of the materials, on the right side, there will be a tab labeled Textures that will be selected by default. It will contain the names of all the textures being used by that material, and these will all be the names of the old textures. Switch over to the texture <code>sbfres</code> now, and change all the textures to names that fit your new actor.
When changing the names of the materials, on the right side, there will be a tab labeled Textures that will be selected by default. It will contain the names of all the textures being used by that material, and these will all be the names of the old textures. Switch over to the texture <code>sbfres</code> now, and change all the textures to names that fit your new actor.
When you are done changing all the names of the textures, switch back to the model <code>sbfres</code> and look at the Textures section of the material. Click on one of the entries in the table (for example, <code>[OldModelName]_Alb</code>) and then click on Edit. A new window will pop up, with a list of all the textures contained in the texture <code>sbfres</code>. Choose the one that corresponds with the new texture (for example, <code>[NewModelName]_Alb</code> or <code>[NewModelName]_Alb.0</code>) and click save. Do this for all the entries in the Textures table for this material, and then repeat the process for every other material.
When you are done changing all the names of the textures, switch back to the model <code>sbfres</code> and look at the Textures section of the material. Click on one of the entries in the table (for example, <code>[OldModelName]_Alb</code>) and then click on Edit. A new window will pop up, with a list of all the textures contained in the texture <code>sbfres</code>. Choose the one that corresponds with the new texture (for example, <code>[NewModelName]_Alb</code> or <code>[NewModelName]_Alb.0</code>) and click save. Do this for all the entries in the Textures table for this material, and then repeat the process for every other material.
[[File:Addingitems bftxp.png|alt=Bftxp file editing|thumb|Some of the parts of a bftxp file that need to be edited (underlined in red)]]
[[File:Addingitems_bftxp.png|alt=Bftxp file editing|thumb|Some of the parts of a bftxp file that need to be edited (underlined in red)]]
If you are editing an armor that is dyeable, you then need to expand the Animations folder on the left, then Texture Pattern Animations, then right-click the folder that corresponds to your item (Head for the head, Upper for the torso, Lower for the legs). Select Export, and save it somewhere. Open the new <code>bftxp</code> file that you just saved in a text editor. It will contain a lot of gibberish and empty space. '''Make sure you only edit data that is in plain english, editing anything else will break the file.''' You will need to edit all the texture and material names to the new ones. For example, changing <code>[OldModelName]_Alb.0</code> to <code>[NewModelName]_Alb.0</code> and <code>[OldMaterialName]</code> to <code>[NewMaterialName]</code> (e.g. <code>Mt_Hood_001</code> to <code>Mt_Hood_9001</code>). Save it, then, back in Switch Toolbox, right-click on the folder inside Texture Pattern Animations that corresponds to your item, and select Replace. Select the <code>bftxp</code> you edited.
If you are editing an armor that is dyeable, you then need to expand the Animations folder on the left, then Texture Pattern Animations, then right-click the folder that corresponds to your item (Head for the head, Upper for the torso, Lower for the legs). Select Export, and save it somewhere. Open the new <code>bftxp</code> file that you just saved in a text editor. It will contain a lot of gibberish and empty space. '''Make sure you only edit data that is in plain English, editing anything else will break the file.''' You will need to edit all the texture and material names to the new ones. For example, changing <code>[OldModelName]_Alb.0</code> to <code>[NewModelName]_Alb.0</code> and <code>[OldMaterialName]</code> to <code>[NewMaterialName]</code> (e.g. <code>Mt_Hood_001</code> to <code>Mt_Hood_9001</code>). Save it, then, back in Switch Toolbox, right-click on the folder inside Texture Pattern Animations that corresponds to your item, and select Replace. Select the <code>bftxp</code> you edited.


When you are done, select any file or folder from the model <code>sbfres</code>, in the list on the left, and save it. Switch Toolbox will ask if you want to Yaz0 compress the file, click Yes. Then click on any file or folder from the texture <code>sbfres</code>, in the list on the left, and save it. Switch Toolbox will again ask if you want to Yaz0 compress the file, click Yes. If you are editing a WiiU texture <code>sbfres</code>, it will then ask you to save the Tex2 sbfres, so save it and Yaz0 compress it, as well. And that's it, you are done with the files that tell the game what the new item looks like.
When you are done, select any file or folder from the model <code>sbfres</code>, in the list on the left, and save it. Switch Toolbox will ask if you want to Yaz0 compress the file, click Yes. Then click on any file or folder from the texture <code>sbfres</code>, in the list on the left, and save it. Switch Toolbox will again ask if you want to Yaz0 compress the file, click Yes. If you are editing a WiiU texture <code>sbfres</code>, it will then ask you to save the Tex2 sbfres, so save it and Yaz0 compress it, as well. And that's it, you are done with the files that tell the game what the new item looks like.


=== Creating an inventory icon ===
=== Creating an inventory icon ===
{{Empty section}}
This section covers the inventory icons, the square images you see in the inventory grid in the pause menu. These files are kept in <code>content\UI\StockItem</code> for inventory items. Copy the old <code>sbitemco</code> file for the item you are using as your foundation, to the same location in your mod files (<code>content\UI\StockItem</code>). An <code>sbitemco</code> file is pretty much the same thing as an <code>sbfres</code> for textures, so you will edit it the same way, using Switch Toolbox. Make sure to change the name of the file to <code>[NewActorName].sbitemco</code>, the name of the file it contains in Toolbox to <code>[NewActorName].bitemco</code>, and the texture it contains to <code>[NewActorName]</code>


=== Creating an inventory name and description ===
=== Creating an inventory name and description ===
Line 165: Line 169:


=== Creating the save game data flags ===
=== Creating the save game data flags ===
{{Empty section}}
[[File:Addingitems crc32hash.png|thumb|Click on the three lines (1) to select Programmer, then click on (3) until it says DWORD, then click on HEX in (2), paste your CRC-32 result, and click on DEC in (2) to get the value you need.]]
This section covers the save game flags, which the game uses to remember whether or not you've picked up an item before. If you are adding a common item, like a material or consumable, this will make it so that the little popup that happens the first time you pick up an item, doesn't happen every single time you pick your new item up.
 
Save flags are all stored in <code>Bootup.pack</code>, so you're going to copy that file from your UPDATE data's <code>content\Pack</code> to the same place in your mod files. You will then open a Powershell window in that folder, and use the command <code>sarc extract Bootup.pack</code> to extract it. This will extract all the data inside the file into folders. Navigate to the new <code>content\Pack\Bootup\GameData</code> and find <code>gamedata.ssarc</code>. Open a new Powershell window here and use the command <code>sarc extract gamedata.ssarc</code>. This will create a new folder named <code>gamedata</code>. Go inside that folder and find <code>bool_data_0.bgdata</code>. Open yet another Powershell window here and run the command <code>byml_to_yml bool_data_0.bgdata !!.yml</code> to convert it to text, and then open the new <code>bool_data_0.yml</code> in a text editor.
 
Inside that file, find the text <code>IsGet_[OldActorName]</code> and copy the entire section into the space right after it. Change <code>IsGet_[OldActorName]</code> to <code>IsGet_[NewActorName]</code>. Then, go to [https://crccalc.com/ this website] and paste <code>IsGet_[NewActorName]</code> into the field, and click Calc CRC-32. Copy the result in the Result column for the CRC-32 row.
 
Next, open the standard Windows calculator, for example by pressing WindowsKey+R, typing "calc" and hitting enter. Change your calculator to programmer mode by clicking on the 3 horizontal lines on the top left, and selecting Programmer. There should be a big 0 near the top middle, and, below that and to the left, four labels: HEX, DEC, OCT, and BIN, all of which should be 0. Right below those and to the right should be either QWORD, DWORD, WORD, or BYTE. Click on that until it says DWORD.
 
Click on HEX to enter hexadecimal mode, and then paste the CRC-32 you copied. Click on DEC, and it will convert that to a number. Remove the commas from the result.
[[File:Addingitems booldata0.jpg|thumb|Once you've copied the boolean data section, change the DataName and HashValue to match your new item.]]
In your text editor, paste the result from your calculator into the <code>HashValue</code> after <code>IsGet_[NewActorName]</code>, and save the file.
 
Open a Powershell window in the folder with <code>bool_data_0.yml</code> and run the command <code>byml_to_yml bool_data_0.yml !!.bgdata</code> . '''If you are modding for WiiU or Cemu, the command is, instead,<code>byml_to_yml -b bool_data_0.yml !!.bgdata</code>'''. Once it's converted, delete <code>bool_data_0.yml</code>.
 
Go up one folder, to <code>content\Pack\Bootup\GameData</code> and open a new Powershell window. Run the command <code>sarc create gamedata gamedata.ssarc</code>. '''If you are modding for WiiU or Cemu, the command is, instead,<code>sarc create gamedata gamedata.ssarc -b</code>'''. Once it's converted, delete the gamedata folder.
 
Go up two folders, to <code>content\Pack</code>, and open a new Powershell window. Run the command <code>sarc create Bootup Bootup.pack</code>. '''If you are modding for WiiU or Cemu, the command is, instead,<code>sarc create Bootup Bootup.pack -b</code>'''. Once it's converted, delete the Bootup folder.
 
=== Finishing up and installing the mod ===
And now you are done! There is a file that remains to be edited, called the RSTB, but you should not manually edit that file anymore, as there are so many other mods that edit it, along with the ActorInfo.product file, the Bootup and Bootup_XXxx packs, that it is not going to be compatible with any other mod that also does so. Instead we use <code>bcml</code> to install mods, merge the changes made to those files, and edit the RSTB for us. Open <code>bcml</code> via Powershell (just run the command <code>bcml</code>) and select Install... Then select Add Folder, select the <code>BreathOfTheWild_[MyAwesomeModName]</code> folder, and click OK. Wait for it to install, and you're ready to play the game with your new item!


== Troubleshooting ==
== Troubleshooting ==
{{Empty section}}
{{Empty section}}
[[Category:Guides]]
[[Category:Guides]]
Anonymous user

Navigation menu