Modding:Treasure Tables: Difference between revisions

From bg3.wiki
Jump to navigation Jump to search
(Created page with "<templatestyles src="Module:Message box/ombox.css"></templatestyles><table class="ombox ombox-notice plainlinks" role="presentation"><tr><td class="mbox-image">35px|link=</td><td class="mbox-text">This page is a modding page, and follows its own rules and standards separate from the rest of the wiki.</td></tr></table> <templatestyles src="Hlist/styles.css"></templatestyles><templatestyles src="Module...")
 
(explained a treasure table)
Line 1: Line 1:
<templatestyles src="Module:Message box/ombox.css"></templatestyles><table class="ombox ombox-notice plainlinks" role="presentation"><tr><td class="mbox-image">[[File:Bliss_Spores_Condition_Icon.webp|35px|link=]]</td><td class="mbox-text">This page is a [[Modding:Modding resources|modding page]], and follows its own rules and standards separate from the rest of the wiki.</td></tr></table>
<templatestyles src="Module:Message box/ombox.css"></templatestyles><table class="ombox ombox-notice plainlinks" role="presentation"><tr><td class="mbox-image">[[File:Bliss_Spores_Condition_Icon.webp|35px|link=]]</td><td class="mbox-text">This page is a [[Modding:Modding resources|modding page]], and follows its own rules and standards separate from the rest of the wiki.</td></tr></table>
<templatestyles src="Hlist/styles.css"></templatestyles><templatestyles src="Module:Sidebar/styles.css"></templatestyles><table class="sidebar nomobile nowraplinks"><tr><th class="sidebar-title">bg3.wiki modding</th></tr><tr><th class="sidebar-heading">
<templatestyles src="Hlist/styles.css"></templatestyles><templatestyles src="Module:Sidebar/styles.css"></templatestyles>One of the many types of text files crucial to a mod maker's toolkit are Treasure Tables. Treasure Tables define all inventories in the game- what is in them, and what could be. All chests, traders, and corpses use treasure tables to define their loot. For mods adding items, the main way for them to appear in game is to add them to one treasure table or another. Most commonly, mods that add items just for the sake of it add their items to the tutorial chest, a cartilaginous chest found on the Nautiloid. This page goes over the basics of treasure tables.
 
Let's look at an excerpt from one of the TreasureTable.txt files in the game:
 
new treasuretable "Gold_Pocket_Wealthy"
 
new subtable "10,1;11,1;12,1;13,1"
 
object category "Gold",1,0,0,0,0,0,0,0
 
 
The first line, in a rather self explanatory manner, creates a new treasure table named "Gold_Pocket_Wealthy"
 
The second line looks much more confusing, but isn't. Every item within a table needs a subtable. If you want 1 potion of healing that's guaranteed to be in the treasure table, it would still need its own subtable. So, with that in mind, a subtable is created. The numbers within the quotation marks denote the weights for how many times the table will be rolled- As an example, the weights for this table start with "10,1", so, with a weight of 1 (equal to everything else in the table), this table could be rolled 10 times. That means we would get 10 of whatever is listed in the table below. Each subsequent numbered pair denotes another quantity & weight pair- "11,1" means there is a weight of 1 that the table will be rolled 11 times, and so on.
 
The final line, much like the first, is pretty self explanatory. the "object category" that it begins with is necessary for all items within a subtable- it doesn't mean much to us, since it always stays the same, but it means a lot to the code. "Gold" quite obviously means Gold, the game's currency. The 1 is the number of items- so, if it were a 10 instead, each time the table was rolled, it would give 10 gold. Therefore, if the table was decided to be rolled 11 times in the previous step, you would get 110 gold. In this case, you would only get 11. The 1 is followed by 7 zeros. Every example I can find always has these zeros- they just seem to be necessary for the code to work and don't seem to mean much.<table class="sidebar nomobile nowraplinks"><tr><th class="sidebar-title">bg3.wiki modding</th></tr><tr><th class="sidebar-heading">
Modding homepage</th></tr><tr><td class="sidebar-content hlist">
Modding homepage</th></tr><tr><td class="sidebar-content hlist">
* [[Modding:Modding resources|Modding resources]]</td>
* [[Modding:Modding resources|Modding resources]]</td>

Revision as of 18:42, 14 August 2024

One of the many types of text files crucial to a mod maker's toolkit are Treasure Tables. Treasure Tables define all inventories in the game- what is in them, and what could be. All chests, traders, and corpses use treasure tables to define their loot. For mods adding items, the main way for them to appear in game is to add them to one treasure table or another. Most commonly, mods that add items just for the sake of it add their items to the tutorial chest, a cartilaginous chest found on the Nautiloid. This page goes over the basics of treasure tables.

Let's look at an excerpt from one of the TreasureTable.txt files in the game:

new treasuretable "Gold_Pocket_Wealthy"

new subtable "10,1;11,1;12,1;13,1"

object category "Gold",1,0,0,0,0,0,0,0


The first line, in a rather self explanatory manner, creates a new treasure table named "Gold_Pocket_Wealthy"

The second line looks much more confusing, but isn't. Every item within a table needs a subtable. If you want 1 potion of healing that's guaranteed to be in the treasure table, it would still need its own subtable. So, with that in mind, a subtable is created. The numbers within the quotation marks denote the weights for how many times the table will be rolled- As an example, the weights for this table start with "10,1", so, with a weight of 1 (equal to everything else in the table), this table could be rolled 10 times. That means we would get 10 of whatever is listed in the table below. Each subsequent numbered pair denotes another quantity & weight pair- "11,1" means there is a weight of 1 that the table will be rolled 11 times, and so on.

The final line, much like the first, is pretty self explanatory. the "object category" that it begins with is necessary for all items within a subtable- it doesn't mean much to us, since it always stays the same, but it means a lot to the code. "Gold" quite obviously means Gold, the game's currency. The 1 is the number of items- so, if it were a 10 instead, each time the table was rolled, it would give 10 gold. Therefore, if the table was decided to be rolled 11 times in the previous step, you would get 110 gold. In this case, you would only get 11. The 1 is followed by 7 zeros. Every example I can find always has these zeros- they just seem to be necessary for the code to work and don't seem to mean much.