rndmagic.2da

This file defines what items are generated when a creature uses an item of filename RNDMAGx#.ITM, where x=any character (even letters and symbols, and has no bearing on how RNDMAGIC.2DA is read), and #=the row number of RNDMAGIC.2DA to use (can be 1-9). RNDMAGx#.ITM is replaced by the generated item. Therefore, this works like a random treasure table.

The first column of RNDMAGIC.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 RNDTREAS.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 BG2:ToB version of RNDMAGIC.2DA is shown below. In essence, RNDMAGIC.2DA works exactly the same as RNDEQUIP.2DA, so see RNDEQUIP.2DA for an example of how RNDMAGIC.2DA works. However, RNDMAGIC.2DA can be directly referenced by RNDTREAS.2DA or RNDEQUIP.2DA without actually having RNDMAGx#.ITM as a resource. For example, an entry in RNDTREAS.2DA that reads RNDMAG03, and a D20 roll of 3 will replace RNDTREx#.ITM with BOLT05.

In BG2:ToB we have:
2DA V1.0
*
           2          3          4          5          6          7          8          9          10         11         12         13         14         15         16         17         18         19         20         
LOW        RNDWEP02   RNDWEP01   BULL03*3   POTN31     RNDSCR02   RNDSCR01   SCRL06     SCRL04     POTN08     POTN43     POTN44     POTN37     POTN19     POTN28     BULL02*5   AROW02*5   BOLT02*5   RNDWEP01   RNDWEP02   
HIGH       RNDWEP03   RNDWEP02   RNDWEP01   SCRL08     SCRL09     RNDSCR03   SCRL16     POTN17     POTN08     POTN10     AROW04     AROW09     BOLT04     BOLT03     AROW06     RNDWEP01   RNDWEP02   RNDWEP02   RNDWEP03   
RNDMAGIC.2DA supports 9 functional rows of random treasure. Rows 10 and above are completely ignored. If RNDMAGx#.ITM references a non-existant or an ignored row number (or if #=0 under any circumstances), then RNDMAGx#.ITM is replaced by an erroneous invisible item that cannot be removed. Note that the replacing item is NOT RNDMAGx#.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:

Items that cannot be referenced:

Since RNDMAGIC.2DA can reference RNDSCROL.2DA and RNDWEP.2DA but not RNDTREAS.2DA nor RNDEQUIP.2DA, this 2da file is the third to the top of the random treasure table hierarchy.