Help:Adding items: Difference between revisions

Jump to navigation Jump to search
Rewrite for using hyrule_builder for all conversions
imported>Leoetlino
(remove {{in creation}})
imported>Ginger
(Rewrite for using hyrule_builder for all conversions)
Line 9: Line 9:
*Breath of the Wild Cemu Mod Loader (or <code>bcml</code>) {{Install py package help|package=bcml}}
*Breath of the Wild Cemu Mod Loader (or <code>bcml</code>) {{Install py package help|package=bcml}}
*[https://github.com/KillzXGaming/Switch-Toolbox/releases Switch Toolbox]
*[https://github.com/KillzXGaming/Switch-Toolbox/releases Switch Toolbox]
*BotW Duplicator Tools {{Install py package help|package=botw-duplicator-tools}}
*Hyrule Builder {{Install py package help|package=hyrule_builder}}
*[https://gitlab.com/jkcclemens/msyt/ msyt], [https://github.com/polarbunny/msyt-tools/releases/latest msyt-tools], [https://github.com/IcySon55/3DLandMSBTeditor/releases MSBT Editor], or [https://github.com/IcySon55/Kuriimu/releases/latest Kuriimu]


==Tutorial==
==Tutorial==
Line 50: Line 49:
First, figure out what item (that already exists in game) behaves closest to your new item. Find the <code>sbactorpack</code> file for that item, and copy it to <code>content\Actor\Pack</code>. You will find the original file in your dumped UPDATE files (not the base game files), in the same location. (<code>content\Actor\Pack</code>) Make sure you copy it, and don't move the original.
First, figure out what item (that already exists in game) behaves closest to your new item. Find the <code>sbactorpack</code> file for that item, and copy it to <code>content\Actor\Pack</code>. You will find the original file in your dumped UPDATE files (not the base game files), in the same location. (<code>content\Actor\Pack</code>) Make sure you copy it, and don't move the original.


====Unpacking the actor pack====
Next, copy <code>ActorInfo.product.sbyml</code> to <code>content\Actor</code> in your mod files. You can find it in your dumped UPDATE files (not the base game files), in the same location. Make sure you copy it, and don't move the original.
Not every file in the actor pack will need to be edited, and there are multiple ways to obtain the file from the actor pack. Any of the following three ways should work. You need only use one method. If one doesn't work for you, try another one. You will be editing any file that contains the actor name as its file name, or contains that actor name inside it. For most actors, that means the files with file extensions <code>bxml</code>, <code>bmodellist</code>, <code>bgparamlist</code>, and <code>bphysics</code>. If the item is craftable, you will also need to change the file with file extension <code>brecipe</code>. If the actor has physics, you will also need to change the files with file extensions <code>bphyssb</code> and <code>hkcl</code>. Other actor types may have additional files to change, so look thoroughly.


=====Using Switch Toolbox=====
Then, copy both <code>Bootup.pack</code> and <code>Bootup_[XXxx].pack</code> to <code>content\Pack</code> in your mod files. You can find them in your dumped UPDATE files (not the base game files), in the same location. There will be several <code>Bootup_[XXxx].pack</code> files. Each one is for a different region and language. For example, USen is for the US version, English language, while EUes is for the European version, Spanish language. Copy only the one(s) you will be making edits for, as any languages that you don't edit will have entries automatically copied into them by one of the later steps in the tutorial. For example, if you edit USen and EUes, EUen will receive your custom entries from USen, and USes will receive your custom entries from EUes.
Open Switch Toolbox, and then open the actor pack file in it. Expand the folders on the left side to find the files you need to edit, right click on them, and select Export Raw Data To File Location. You can then find the files in the same folder as the actor pack. Then, open a Powershell window in that folder, and use the command <code>aamp [FileName].[FileExtension] [FileName].[FileExtension].yml</code> for each file you extracted. Then open the files in the editor of your choice.


=====Using Wild Bits=====
Lastly, copy your resource files to <code>content\Model</code> (models and textures) and <code>content\UI\StockItem</code> (icons). These files aren't handled by the converter, they're explained more in depth in their own section of the tutorial.
Open Wild Bits, navigate to the SARC Tools tab, then open the actor pack file in it. You will see a hierarchy of the folders. Search for one of the files you need to modify, right-click on it, and open it in the AAMP editor. Wild Bits will automatically take you to the YAML Tools tab and open the file for editing.


=====Using <code>sarc</code>=====
Once you have your mod files assembled navigate to the folder that contains your BreathOfTheWild_[MyAwesomeModName] folder, open a Powershell window, and run the command <code>hyrule_builder unbuild BreathOfTheWild_[MyAwesomeModName]</code>. It will take a bit of time to convert the files, and then create a new folder called BreathOfTheWild_[MyAwesomeModName]_unbuilt, which contains the files you will be editing.
Open Powershell window in the folder containing the actor pack. Use the command <code>sarc extract [FileName].sbactorpack</code>. This will create a new folder with all of the individual files. For each file you modify, you will need to open another Powershell window in that folder and use the command <code>aamp [FileName].[FileExtension] !!.yml</code>. Then open the files in the editor of your choice.


====Editing the actor pack files====
===Editing the actor pack files===
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.
The actor pack files will be located in the various folders inside <code>content\Actor</code>. 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 and the contents of each file)]]
[[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:
*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>content\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>content\Actor\Physics</code>
**changing the name of the <code>[ActorName].bxml</code> file inside <code>Actor/ActorLink</code>
**changing the name of the <code>[ActorName].bxml</code> file inside <code>content\Actor\ActorLink</code>
**changing the name of the <code>[ActorName].bgparamlist</code> file inside <code>Actor/GeneralParamList</code>
**changing the name of the <code>[ActorName].bgparamlist</code> file inside <code>content\Actor\GeneralParamList</code>
**changing the name of the <code>[BfresName]</code> folder inside <code>Physics/SupportBone</code>
**changing the name of the <code>[BfresName]</code> folder inside <code>content\Physics\SupportBone</code>
**changing the name of the <code>[ModelName].bphyssb</code> file inside <code>Physics/SupportBone/[BfresName]</code>
**changing the name of the <code>[ModelName].bphyssb</code> file inside <code>content\Physics\SupportBone\[BfresName]</code>
**changing the name of the <code>[BfresName]</code> folder inside <code>Physics/Cloth</code>
**changing the name of the <code>[BfresName]</code> folder inside <code>content\Physics\Cloth</code>
**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>content\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 <code>bfres</code> name
**changing the line that says <code>Folder: !str64 [BfresName]</code> to the new <code>bfres</code> name
Line 93: Line 88:
Once you've made your changes, '''make sure to save'''.
Once you've made your changes, '''make sure to save'''.


====Packing the actor pack====
===Adding the actor info===
Once all the edits have been made, you are ready to put everything back into the actor pack. As with unpacking it, each method has its own way of packing it again.
The previous step saw you creating the actual actor. This step is for creating the actor metadata that the game uses so that it knows your new actor exists. It also stores most data that appears in menus like the pause menu, crafting menu, or store menus.


=====Using Switch Toolbox=====
Inside <code>content\Actor\ActorInfo</code>, you will find a file for each actor in the game. Find the one for the old actor that you are using as your base, and copy it, changing the name of the new file to <code>[NewActorName].info.yml</code>, then open the file in a text editor. Change the following lines:
First you will need to convert the text actor files back to their corresponding types. Open a Powershell window in the folder that contains the files you changed, and use the command <code>aamp [FileName].[FileExtension].yml [FileName].[FileExtension]</code> for each file you extracted.
 
Open the actor pack in Switch Toolbox again. Switch Toolbox is kind of wonky, and doesn't like replacing data for existing files, but it can import new data just fine. So, for every file you're going to add back into the actor pack, you will delete the original file, then right-click on the folder that contained it, and select to import the new file. Then click to save the file. Make sure you change the name of the file to the new actor name! You will be asked to Yaz0 compress the file. Click yes. And now you're done.
 
=====Using Wild Bits=====
When you've made your changes to the files in the YAML Tools tab and saved them, just click the button to save the actor pack, then change the name of the actor pack file to the new actor name. That's it, you're done.
 
=====Using <code>sarc</code>=====
First, convert the text actor files back to their corresponding types. Open a Powershell window in the folder that contains the files you changed, and use the command <code>aamp [FileName].yml !!.[FileExtension]</code> for each file you extracted. Once you have converted a yml file back to its original file type, make sure you delete the yml file. If you do not, it will be packed into the actor pack and that will cause errors and crashes.
 
Once you have converted all of the files back to their original types and deleted all the yml files, return to the <code>content\Actor\Pack</code> folder of your mod, and open another Powershell window, then pack everything back into the actor pack with the command <code>sarc create [FolderName] [FileName].sbactorpack</code>. '''If you are modding for WiiU or Cemu, the command is, instead, <code>sarc create [FolderName] [FileName].sbactorpack -b</code>'''. Once you have done so, make sure you change the name of the actor pack to the new actor name (you can also just use the new actor name as the FileName in the Powershell command). After that, make sure you delete the folder of un-sarc'ed actor files, and the old actor pack, if applicable. And you are now done.
 
===Adding the actor info to the ActorInfo.product file===
The previous step saw you creating the actual actor. This step is for creating the actor metadata that the game uses so that it knows your new actor exists. It also stores most data that appears in menus like the pause menu, crafting menu, or store menus. There are two main ways to do this, but first we need to copy the file so we can edit it. Find the original ActorInfo.product.sbyml file in your dumped UPDATE files (not the base game files), in <code>content\Actor</code>, and copy it to the same place in your mod's files. (<code>content\Actor</code>) Make sure you copy it, and don't move the original.
 
Then, open a Powershell window where your copied ActorInfo.product file is, and run the command <code>actorinfo_tool ActorInfo.product.sbyml duplicate [OldActorName] [NewActorName]</code> where the old actor name is the actor you copied during the Create the Actor step of this tutorial. '''If you are modding for WiiU or Cemu, the command is, instead, <code>actorinfo_tool -b ActorInfo.product.sbyml duplicate [OldActorName] [NewActorName]</code>'''.
 
====Using Wild Bits====
Open Wild Bits, and go to the YAML Tools tab. Open your ActorInfo.product file. Find the entry you duplicated (it will have your new actor name on the line <code>name: [NewActorName]</code>). Change the following lines:


*<code>bfres: [BfresName]</code> to your new <code>bfres</code> name
*<code>bfres: [BfresName]</code> to your new <code>bfres</code> name
Line 122: Line 98:
*Any additional information you changed in the actor pack that might be shown in any menu. For example, armor value of armor, defensive value of shields, damage of weapons, buying/selling price of items from/to a shop, crafting ingredients if the item is craftable, etc.
*Any additional information you changed in the actor pack that might be shown in any menu. For example, armor value of armor, defensive value of shields, damage of weapons, buying/selling price of items from/to a shop, crafting ingredients if the item is craftable, etc.


Once all the info is changed, click save.
Once all the info is changed, '''make sure to save'''.
 
====Using a text editor====
Open a Powershell window where your copied ActorInfo.product is (you probably already have one open from when you ran the <code>actorinfo_tool</code> command) and run the command <code>byml_to_yml ActorInfo.product.sbyml !!.yml</code>. Open the new ActorInfo.product.yml file in your file editor of choice. Find the entry you duplicated (it will have your new actor name on the line <code>name: [NewActorName]</code>). Change the following lines:
 
*<code>bfres: [BfresName]</code> to your new <code>bfres</code> name
*<code>itemUseIconActorName: [ActorName]</code> to your new actor name
*<code>mainModel: [ModelName]</code> to your new model name
*Any additional information you changed in the actor pack that might be shown in any menu. For example, armor value of armor, defensive value of shields, damage of weapons, buying/selling price of items from/to a shop, crafting ingredients if the item is craftable, etc.
 
Once all the info is changed, click save. Open another Powershell window where <code>ActorInfo.product.yml</code> is (you might have left the previous one open, you can use that), and run the command <code>yml_to_byml ActorInfo.product.yml !!.sbyml</code>. '''If you are modding for WiiU or Cemu, the command is, instead,<code>yml_to_byml -b ActorInfo.product.yml !!.sbyml</code>'''. Delete <code>ActorInfo.product.yml</code>, because it has been converted back and is no longer needed.


===Creating the resource files===
===Creating the resource files===
Line 166: Line 132:


===Creating an inventory name and description===
===Creating an inventory name and description===
There are many ways to add text to the game, some work better for single items, some work better for large-scale mods that edit lots of text. There are three main ways to edit the text files of the game: by converting them to text with <code>msyt</code> or <code>msyt-tools</code>, by editing them "directly" with Wild Bits, or by using a GUI like MSBT Editor or Kuriimu.
For the in-game text concerning your item, you will need to navigate to <code>content\Pack\Bootup_[XXxx].pack\Message\Msg_[XXxx].product.ssarc</code>. There are many <code>msbt</code> files here, and all of them have text data for the game. For your actor, you'll look in the <code>ActorType</code> folder. Find the file that fits your item type, and open it in your text editor of choice.
 
====Using <code>msyt</code> or <code>msyt-tools</code>====
{{Empty section}}
 
====Using Wild Bits====
{{Empty section}}


====Using MSBT Editor or Kuriimu====
Find the name and description entries for the item you used as your base, and copy them to the bottom of the file. An entry in this file starts on the line that says <code>[ActorName]_Name</code> or <code>[ActorName]_Desc</code> and ends one line before the next time that appears. If your item is something that would appear in the Shiekah Slate album, so that you could take pictures of it and track it on the map with the Sheikah Radar, also add an <code>[ActorName]_PictureBook</code>.
First, you will need to copy the text archive to your files, so navigate to the <code>content\Pack</code> folder of the your game's UPDATE files. There will be several <code>Bootup_[XXxx].pack</code> files here. Each one is for a different region and language. For example, USen is for the US version, English language, while EUes is for the European version, Spanish language. Find the pack for the region/language you want to edit, and copy it to your mod's <code>content\Pack</code> folder.


Next, you'll need to extract it, so open a Powershell window and run the command <code>sarc extract Bootup_[XXxx].pack</code>. Go inside the newly created <code>Bootup_[XXxx]/Message</code> folder to find a file called <code>Msg_[XXxx].product.ssarc</code>. Open another Powershell window and use the command <code>sarc extract Msg_[XXxx].product.ssarc</code> to extract it, as well, then go into the new <code>Msg_[XXxx].product\ActorType</code> folder.
Change the <code>- text:</code> line of the name to be your new name, and the <code>- text:</code> line of the description to be your description. If your name or description uses apostrophes, be sure to surround it in quotes. e.g. <code>Zora Mask</code> is fine, but <code>"Zora's Mask"</code> needs the quotes because it contains an apostrophe. If you have a picture book entry as well, copy the text you made for <code>[ActorName]_Desc</code> into it.


There are many <code>msbt</code> files here, and all of them have text data for the game. Find the one that fits your item type, and open it in MSBT Editor or Kuriimu. These programs both act very similarly, and the directions here will work for either program.
When you're done, '''make sure to save'''.
 
Once you've opened the <code>msbt</code> file, click on the green plus to add a new piece of text to the list, (in MSBT Editor, you'll type the name in the bar next to the plus first, while in Kuriimu you'll click the plus first and type the name in second) and name it <code>[ActorName]_Name</code>. Do it again, and this time, call it <code>[ActorName]_Desc</code>. Name is going to be for the item's name as it is shown in menus, and Desc is going to be for the item's descriptions. If your item is something that would appear in the Shiekah Slate album, so that you could take pictures of it and track it on the map with the Sheikah Radar, also add an <code>[ActorName]_PictureBook</code> and copy the text you made for <code>[ActorName]_Desc</code> into it. When you're done, File -> Save.
 
You'll now need to pack all the files back up, so go back to the <code>content\Pack\Bootup_[XXxx]\Message</code> folder, open a Powershell window and run the command <code>sarc create Msg_[XXxx].product Msg_[XXxx].product.ssarc</code>. '''If you are modding for WiiU or Cemu, the command is, instead,<code>sarc create Msg_[XXxx].product Msg_[XXxx].product.ssarc -b</code>'''. Once it has finished packing up the file, delete the <code>Msg_[XXxx].product</code> folder.
 
Then, go back to <code>content\Pack</code>, open another Powershell window and run the command <code>sarc create Bootup_[XXxx] Bootup_[XXxx].pack</code>. '''If you are modding for WiiU or Cemu, the command is, instead,<code>sarc create Bootup_[XXxx] Bootup_[XXxx].pack -b</code>'''. Once it has finished, delete the <code>Bootup_[XXxx]</code> folder. And now you're done with the menu text portion of your item.


===Creating the save game data flags===
===Creating the save game data flags===
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.
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.
Navigate to <code>content\Pack\Bootup.pack\GameData\gamedata.ssarc</code> and find the flag for your base game item. It might be contained in any of the <code>bool_data_#.bgdata.yml</code> files. The name you are looking for is <code>IsGet_[OldActorName]</code>.
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.
[[File:Addingitems_crc32hashpython.png|thumb|After running the python command, copy the underlined result to use as your HashValue]]
[[File:Addingitems_crc32hashpython.png|thumb|After running the python command, copy the underlined result to use as your HashValue]]
Open a new Powershell window. Use the command <code>python</code> to enter a python command line. Run the command <code>import ctypes; ctypes.c_int32([CRC-32Result]).value</code> to obtain a positive or negative number. <code>[CRC-32Result]</code> should be replaced with what you copied from the Result column for the CRC-32 row.
Copy the entire section for the flag into the space right after that flag. Change <code>IsGet_[OldActorName]</code> to <code>IsGet_[NewActorName]</code>. Then, open a new Powershell window anywhere. Use the command <code>python</code> to enter a python command line. Run the command <code>import ctypes; import binascii; ctypes.c_int32(binascii.crc32('''IsGet_[NewActorName]''')).value</code> to obtain a positive or negative number. (Bolding has been added to distinguish the name of the flag. You need to use the actual name of the flag you're adding.)
[[File:Addingitems_booldata0.jpg|thumb|Once you've copied the boolean data section, change the DataName and HashValue to match your new item.]]
[[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.
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>yml_to_byml bool_data_0.yml !!.bgdata</code> . '''If you are modding for WiiU or Cemu, the command is, instead,<code>yml_to_byml -b bool_data_0.yml !!.bgdata</code>'''. Once it's converted, delete <code>bool_data_0.yml</code>.
===Finishing up and installing the mod===
Now that all the files have been edited, you will need to pack them all back up. Go back to the folder that contains BreathOfTheWild_[MyAwesomeModName]_unbuilt, open a Powershell window, and run the command <code>hyrule_builder build [--be] BreathOfTheWild_[MyAwesomeModName]_unbuilt</code>. '''If you are modding for WiiU or Cemu, and don't add the --be, the error you get will seem very confusing. This is because it's looking for the Switch paths and not finding them.''' After a little bit of conversion, a new folder will be created, called BreathOfTheWild_[MyAwesomeModName]_unbuilt_build. That folder contains your completed mod. Delete the old BreathOfTheWild_[MyAwesomeModName] and rename the completed mod folder to BreathOfTheWild_[MyAwesomeModName].


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.
And now you are done! To use the mod, 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!
 
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