/
rndtreas.htm
46 lines (45 loc) · 7.19 KB
/
rndtreas.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
title: "BG(2):EE 2DA Files : rndtreas.2da"
---
<div class="title_main"> rndtreas.2da</div>
<br />
This file defines what items are generated when a creature uses an item of filename <code>RNDTRE0#.ITM</code>, where <code>#</code> is the row number of <code>RNDTREAS.2DA</code> to use. <code>RNDTRE0#.ITM</code> is replaced by the generated item. Therefore, this works like a random treasure table.<br />
<br />
The first column of <code>RNDTREAS.2DA</code> specifies the name of the row, currently a simple generic name. The rest of the 19 columns have headers <code>2</code>, <code>3</code>, <code>4</code>, <code>5</code>, ..., <code>18</code>, <code>19</code>, <code>20</code>. The column used is specified by a roll of a D20, with rolls of 1 replacing <code>RNDTRE0#.ITM</code> with no item. Note that this is different from <code><a href="../2da_bgee/rndequip.htm">RNDEQUIP.2DA</a></code>, <code><a href="../2da_bgee/rndscrol.htm">RNDSCROL.2DA</a></code>, and <code><a href="../2da_bgee/rndweap.htm">RNDWEP.2DA</a></code>, which have an extra column labelled <code>1</code>, but similar to <code><a href="../2da_bgee/rndmagic.htm">RNDMAGIC.2DA</a></code>. Only 20 columns in total are supported, else the 2da file will fail to work entirely. When this happens, all <code>RNDTRE0#.ITM</code>s are replaced by erroneous invisible items that cannot be removed.<br />
<br />
The BG2EE version of <code>RNDTREAS.2DA</code> is shown below. In essence, <code>RNDTREAS.2DA</code> works exactly the same as <code><a href="../2da_bgee/rndequip.htm">RNDEQUIP.2DA</a></code>, so see <code><a href="../2da_bgee/rndequip.htm">RNDEQUIP.2DA</a></code> for an example of how <code>RNDTREAS.2DA</code> works. However, <code>RNDTREAS.2DA</code> can be directly referenced by <code><a href="../2da_bgee/rndequip.htm">RNDEQUIP.2DA</a></code> without actually having <code>RNDTRE0#.ITM</code> as a resource. For example, an entry in <code><a href="../2da_bgee/rndequip.htm">RNDEQUIP.2DA</a></code> that reads <code>RNDTRE05</code>, and a D20 roll of 6 will replace <code>RNDTRE0#.ITM</code> with <code>AMUL12</code>.<br />
<br />
In BG2EE we have:<br />
<pre>
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
</pre>
<br />
<code>RNDTREAS.2DA</code> is supposed to support 9 functional rows of random treasure (from <code>rndtre01.itm</code> up to <code>rndtre09.itm</code>).<br />
However, because of lax or missing range checks it is possible to extend the list quite a bit beyond the nine entries. The engine seems to use the ASCII code of the last filename character. After <code>9</code> there would be <code>:</code>, <code>;</code>, <code><</code>, <code>=</code>, <code>></code>, <code>?</code>, <code>@</code>, followed by <code>A</code> to <code>Z</code>. While characters like <code>:</code> or <code>?</code> are difficult to use because of their special meaning on filesystems, you can still use <code>A</code> to <code>Z</code>, which results in additional 26 random treasures (from <code>rndtre0a.itm</code> up to <code>rndtre0z.itm</code>). The entries between <code>9</code> and <code>A</code> can simply be filled with empty dummy entries.
<br /><br />
If <code>RNDTRE0#.ITM</code> references a non-existant or an ignored row number (or if <code>#=0</code> under any circumstances), then <code>RNDTRE0#.ITM</code> is replaced by an erroneous invisible item that cannot be removed. Note that the replacing item is <b>NOT</b> <code>RNDTRE0#.ITM</code> itself, in this case. This blank item can likely be altered by setting the default 2da entry to a valid item.<br />
<br />
Items that can be referenced:
<ul>
<li>specific items (for stackable items, a <code>*#</code> 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. <code>BOLT04*4</code> generates a single stack of 4 <code>BOLT04</code> items; for non-stackable items, a <code>*#</code> suffix does nothing; the limitations on the size of <code>#</code> are the same as that for gold pieces described below)</li>
<li><code>#</code>, that is, a number, refers to a gold value (e.g. <code>#=016</code> replaces <code>RNDTRE0#.ITM</code> 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; <code>#</code> need not be three digits, so if <code>#=4</code> or <code>#=04</code> or <code>#=004</code>, a stack of 4 gold will still be generated without error) — <code>*</code>, 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</li>
<li><code>RNDMAG##</code>, which references <code><a href="../2da_bgee/rndmagic.htm">RNDMAGIC.2DA</a></code>, where <code>##</code> is the row number to use, allowing further randomisation; a D20 is rolled to determine which column of this file to use</li>
<li><code>RNDSCR##</code>, which references <code><a href="../2da_bgee/rndscrol.htm">RNDSCROL.2DA</a></code>, where <code>##</code> is the row number to use, allowing further randomisation; a D20 is rolled to determine which column of this file to use</li>
<li><code>RNDWEP##</code>, which references <code><a href="../2da_bgee/rndweap.htm">RNDWEP.2DA</a></code>, where <code>##</code> is the row number to use, allowing a third level of randomisation; 2D10 are rolled to determine which column of this file to use</li>
</ul>
<br />
Items that cannot be referenced:
<ul>
<li><code>RNDEQU##</code>; using this will create <code>RNDEQU##.ITM</code>, exactly as it is (circular loops are not possible)</li>
<li><code>RNDTRE##</code>; using this will create <code>RNDTRE##.ITM</code>, exactly as it is (circular loops are not possible)</li>
</ul>
Since <code>RNDTREAS.2DA</code> can reference <code><a href="../2da_bgee/rndmagic.htm">RNDMAGIC.2DA</a></code>, <code><a href="../2da_bgee/rndscrol.htm">RNDSCROL.2DA</a></code>, and <code><a href="../2da_bgee/rndweap.htm">RNDWEP.2DA</a></code> but not <code><a href="../2da_bgee/rndequip.htm">RNDEQUIP.2DA</a></code>, this 2da file is the second to the top of the random treasure table hierarchy.
</div>
</div>