CamDawg Posted September 9, 2021 Posted September 9, 2021 Credit to @argent77 on the Beamdog forums: Quote 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 Quote
CamDawg Posted September 29, 2021 Author Posted September 29, 2021 While BGEE sans SoD doesn't include rndtres.2da by default, it can be added and used. BG2EE and BGEE+SoD both include this file. Quote
Luke Posted October 17, 2021 Posted October 17, 2021 (edited) @argent77 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 October 17, 2021 by Luke Quote
Avenger Posted October 18, 2021 Posted October 18, 2021 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) Quote
Luke Posted October 18, 2021 Posted October 18, 2021 2 hours ago, Avenger said: Or stay BG compatible, then the row index is only one character. OK, so the IESDP is wrong about "rndtreas.2da" (BG style) when it states that the second to last character can be any character... Will fix. Quote
Avenger Posted October 19, 2021 Posted October 19, 2021 20 hours ago, Luke said: OK, so the IESDP is wrong about "rndtreas.2da" (BG style) when it states that the second to last character can be any character... Will fix. It is probably because of TobEx. Maybe mention it too. Quote
Luke Posted October 19, 2021 Posted October 19, 2021 (edited) 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: On EE games, the second to last character must be 0 (I suspect this is true...) On both the Enhanced Editions and the original games, you can actually use more than 9 rows (in particular 'A' to 'Z' characters). Edited October 19, 2021 by Luke Quote
Avenger Posted October 29, 2021 Posted October 29, 2021 Yes, the EE didn't change that much. I think the only change there was to add IWD support while keeping everything else intact. Quote
Recommended Posts
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.