Jump to content

rndtreas expansion

Recommended Posts

Credit to @argent77 on the Beamdog forums:


This topic is already quite old, but I wanted to share an unexpected finding regarding the original and backward compatible random treasure table (rndtreas.2da). IESDP states that only up to 9 different random treasure items are supported ("rndtre01.itm" up to "rndtre09.itm"). The second to last character ('0' in my example) is not considered by the engine.

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.

It works equally well in both the Enhanced Editions and the original games!

Source: https://forums.beamdog.com/discussion/comment/792223/#Comment_792223

Link to comment


So it's not true that the second to last character can be any character...? In particular, it must be "0"...?

If so, then the available entries (filenames) are: "rndtre01.itm" up to "rndtre09.itm" plus "rndtre0a.itm" up to "rndtre0z.itm" (total of 35 entries if we exclude all those special characters such as '='). Is that correct?

Edited by Luke
Link to comment

You can rewrite the whole treasure table like in iwd, where the treasure resref is the first column of the table. Or stay BG compatible, then the row index is only one character.

After the IWD resolution the BG style resolution is executed too. So in your IWD table you can have rndtre0X entries.

No recursion, loop detection would be more difficult than the benefits. The IWD filename (root treasure table is: RNDTRES)


Link to comment
5 hours ago, Avenger said:

It is probably because of TobEx. Maybe mention it too.

OK, will state that it must be 0 on EE games, whereas it can be any character on TobEx games...

And now that we're speaking of it, does the same hold for the other tables (i.e. RNDMAGIC.2DA, RNDSCROL.2DA, RNDWEP.2DA, and RNDEQUIP.2DA)? In particular:

  1. On EE games, the second to last character must be 0 (I suspect this is true...)
  2. On both the Enhanced Editions and the original games, you can actually use more than 9 rows (in particular 'A' to 'Z' characters).
Edited by Luke
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...