rndtreas.2da
This file defines what items are generated when a creature uses an item of filename RNDTREx#.ITM, where x=any character (even letters and symbols, and has no bearing on how RNDTREAS.2DA is read), and #=the row number of RNDTREAS.2DA to use (can be 1-9). RNDTREx#.ITM is replaced by the generated item. Therefore, this works like a random treasure table.
The first column of RNDTREAS.2DA specifies the name of the row, currently a simple generic name. The rest of the 19 columns have headers 2, 3, 4, 5, ..., 18, 19, 20. The column used is specified by a roll of a D20, with rolls of 1 replacing RNDTREx#.ITM with no item. Note that this is different from RNDEQUIP.2DA, RNDSCROL.2DA, and RNDWEP.2DA, which have an extra column labelled '1', but similar to RNDMAGIC.2DA. Only 20 columns in total are supported, else the 2da file will fail to work entirely. When this happens, all RNDTREx#.ITMs are replaced by erroneous invisible items that cannot be removed.
The BG2EE version of RNDTREAS.2DA is shown below. In essence, RNDTREAS.2DA works exactly the same as RNDEQUIP.2DA, so see RNDEQUIP.2DA for an example of how RNDTREAS.2DA works. However, RNDTREAS.2DA can be directly referenced by RNDEQUIP.2DA without actually having RNDTREx#.ITM as a resource. For example, an entry in RNDEQUIP.2DA that reads RNDTRE05, and a D20 roll of 6 will replace RNDTREx#.ITM with AMUL12.
In BG2EE we have:
2DA V1.0 * 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 POOR MISC19 004 SCRL75 001 001 001 001 001 001 001 001 001 001 001 002 002 003 003 MISC16 AVERAGE RNDMAG01 MISC23 AMUL05 MISC17 015 012 SCRL75 008 006 003 001 001 007 009 RNDSCR01 MISC18 MISC22 AMUL06 RNDMAG01 WELL_OFF RNDMAG01 RNDMAG01 AMUL08 MISC20 034 AMUL09 RNDSCR01 008 009 RING11 023 RNDSCR01 RING14 MISC26 MISC25 057 MISC27 MISC28 RNDMAG01 WEALTHY RNDMAG02 RNDMAG01 MISC37 MISC35 RING16 AMUL07 RNDSCR02 047 038 029 AMUL09 RING10 RING15 RNDSCR02 RING13 RING17 MISC34 RNDMAG01 RNDMAG02 RICH RNDMAG02 RNDMAG02 RNDMAG01 RNDMAG01 AMUL12 AMUL13 AMUL10 MISC29 MISC21 073 MISC24 RNDSCR03 MISC34 MISC38 RNDSCR03 RNDMAG01 RNDMAG01 RNDMAG02 RNDMAG02
RNDTREAS.2DA supports 9 functional rows of random treasure. Rows 10 and above are completely ignored. If RNDTREx#.ITM references a non-existant or an ignored row number (or if #=0 under any circumstances), then RNDTREx#.ITM is replaced by an erroneous invisible item that cannot be removed. Note that the replacing item is NOT RNDTREx#.ITM itself, in this case. This blank item can likely be altered by setting the default 2da entry to a valid item.
Items that can be referenced:
- specific items (for stackable items, a *# suffix, that is, an asterisk followed by a number, can be added to the item ResRef to specify the amount of that item to create, e.g. BOLT04*4 generates a single stack of 4 BOLT04 items; for non-stackable items, a *# suffix does nothing; the limitations on the size of # are the same as that for gold pieces described below)
- #, that is, a number, refers to a gold value (e.g. #=016 replaces RNDTREx#.ITM with a stack of 16 gold). The maximum stack of gold allowable is 256 pieces. More than that listed will max out at 231 (interestingly, this is the remainder when you divide 256 into 999; # need not be three digits, so if #=4 or #=04 or #-004, a stack of 4 gold will still be generated without error)-*, that is, a single asterisk, generates an erroneous item, i.e. an invisible item that cannot be removed. This is useful if you want your creature not to drop anything, but you do not want to use this for containers and item piles
- RNDMAG##, which references RNDMAGIC.2DA, where ##=row number to use, allowing further randomisation; a D20 is rolled to determine which column of this file to use
- RNDSCR##, which references RNDSCROL.2DA, where ##=row number to use, allowing further randomisation; a D20 is rolled to determine which column of this file to use
- RNDWEP##, which references RNDWEP.2DA, where ##=row number to use, allowing a third level of randomisation; 2D10 are rolled to determine which column of this file to use
Items that cannot be referenced:
- RNDEQU##; using this will create RNDEQU##.ITM, exactly as it is (circular loops are not possible)
- RNDTRE##; using this will create RNDTRE##.ITM, exactly as it is (circular loops are not possible)