rndtreas.2da
This file defines what items are generated when a creature uses an item of filename
RNDTRE0#.ITM
, where #
is the row number of RNDTREAS.2DA
to use. RNDTRE0#.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 RNDTRE0#.ITM
with no item. Note that this is different from RNDSCROL.2DA
, which has 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 RNDTRE0#.ITM
s are replaced by erroneous invisible items that cannot be removed.The PSTEE version of
RNDTREAS.2DA
is shown below. In essence, RNDTREAS.2DA
works exactly the same as RNDSCROL.2DA
, so see RNDSCROL.2DA
for an example of how RNDTREAS.2DA
works. However, RNDTREAS.2DA
can be directly referenced by RNDSCROL.2DA
without actually having RNDTRE0#.ITM
as a resource. For example, an entry in RNDSCROL.2DA
that reads RNDTRE05
, and a D20 roll of 6 will replace RNDTRE0#.ITM
with AEGIS
.In PSTEE we have:
2DA V1.0 * 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 * 10*10 copear broring brobra rustdag clotchrm dratchrm 10*10 broring 10*10 10*10 copear broring brobra rustdag clotchrm dratchrm 10*10 brobra 2 * 40*50 silear silring silbra stiletto hammer ax bloochrm cratchrm RNDSCR01 40*50 stiletto silear silring silbra 40*50 ax silring cratchrm 3 * 50*100 golear golring golbra axqual qstlo gsknife gsdagger RNDSCR02 hearchrm knotchrm bonechrm 50*100 golring RNDSCR02 gsknife 50*100 bonechrm RNDSCR02 4 * hearchrm 20*500 20*500 20*500 hearchrm 20*500 20*500 20*500 20*500 20*500 hearchrm 20*500 20*500 20*500 hearchrm 20*500 20*500 20*500 20*500 5 * heaven umei zero bell aegis 50*1000 50*1000 50*1000 50*1000 50*1000 50*1000 50*1000 50*1000 50*1000 50*1000 50*1000 50*1000 50*1000 50*1000
RNDTREAS.2DA
is supposed to support 9 functional rows of random treasure (from rndtre01.itm
up to rndtre09.itm
).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
9
there would be :
, ;
, <
, =
, >
, ?
, @
, followed by A
to Z
. While characters like :
or ?
are difficult to use because of their special meaning on filesystems, you can still use A
to Z
, which results in additional 26 random treasures (from rndtre0a.itm
up to rndtre0z.itm
). The entries between 9
and A
can simply be filled with empty dummy entries.If
RNDTRE0#.ITM
references a non-existant or an ignored row number (or if #=0
under any circumstances), then RNDTRE0#.ITM
is replaced by an erroneous invisible item that cannot be removed. Note that the replacing item is NOT RNDTRE0#.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 4BOLT04
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
replacesRNDTRE0#.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 pilesRNDMAG##
, which referencesRNDMAGIC.2DA
, where##
is the row number to use, allowing further randomisation; a D20 is rolled to determine which column of this file to useRNDSCR##
, which referencesRNDSCROL.2DA
, where##
is the row number to use, allowing further randomisation; a D20 is rolled to determine which column of this file to use
Items that cannot be referenced:
RNDEQU##
; using this will createRNDEQU##.ITM
, exactly as it is (circular loops are not possible)RNDTRE##
; using this will createRNDTRE##.ITM
, exactly as it is (circular loops are not possible)
RNDTREAS.2DA
can reference RNDMAGIC.2DA
and RNDSCROL.2DA
, and RNDWEP.2DA
but not RNDEQUIP.2DA
, this 2da file is the second to the top of the random treasure table hierarchy.