Help:Adding items: Difference between revisions

Jump to navigation Jump to search
imported>Ginger
(Formatting changes, save game data section, inventory icon section, installing section)
imported>Ginger
m (Changed calculator method for signed int hash generation to Python method)
Line 23: Line 23:
* 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 (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>.  
* <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 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>.
* 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.
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
* [[File:Addingitems bgparamlist.jpg|thumb|Example of two parameters commonly changed, inside the bgparamlist file.]]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]]. 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).
** 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).
Line 169: Line 169:


=== Creating the save game data flags ===
=== Creating the save game data flags ===
[[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.
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.
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.
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]]
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.
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.
 
[[File:Addingitems_booldata0.jpg|thumb|Once you've copied the boolean data section, change the DataName and HashValue to match your new item.]]
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.
In your text editor, paste the result from your calculator into the <code>HashValue</code> after <code>IsGet_[NewActorName]</code>, and save the file.