[BG(2):EE] Expanded random tables from IWD:EE
swit
Member, Translator (NDA) Posts: 495
Patch 1.3 for BG2:EE back ported most features from IWD:EE, which is great. Thank you.
So, what we have now?
- ini are spawns
- ini cre options (replaces current 2da sound solution, allows to use BMP palettes for animations, custom foot sounds, and some additional adjustments)
- new baldur.ini options (Nightmare mode, 3E Thief Sneak Attack and other options from IWD)
- new script actions and opcodes
So, pretty much everything. What is missing? Fixed random tables implementation. Here is a quote from my old topic:
@Avenger_teambg
So, what we have now?
- ini are spawns
- ini cre options (replaces current 2da sound solution, allows to use BMP palettes for animations, custom foot sounds, and some additional adjustments)
- new baldur.ini options (Nightmare mode, 3E Thief Sneak Attack and other options from IWD)
- new script actions and opcodes
So, pretty much everything. What is missing? Fixed random tables implementation. Here is a quote from my old topic:
The above mentioned implementation is how it works in IWD:EE (when I first posted this suggestion I wasn't even aware that this is an intended implementation, and it was just broken outside of IWD games). I tested it in with the newest BG2:EE patch and this one is still missing. Please consider back-porting it to previous games in next patches.
Here is how the current random items work:
when a creature or container has item of filename RNDTREx#.ITM, where x=any character (even letters and symbols, and has no bearing on how RNDTREAS.2DA is read), and #=the row number of RNDTREAS.2DA to use (can be 1-9), RNDTREx#.ITM is replaced by the randomly generated item.
How it should work: "x" character should not be ignored, so we could assign rows from 1 to 99 instead of 1-9 (5 of them are already reserved by the vanilla game).
Same deal with other random tables: rndequip.2da, rndmagic.2da, rndscrol.2da, rndwep.2da.
@Avenger_teambg
1
Comments
Are you sure it isn't already working like that, with rndtreas.2da ?
Ignore the rest of the tables, those will always remain compatible with BG2.
Check rndtreas.2da which is from IWD/HoW.
We basically support both engines at the same time because the table names are different.
To test it yourself please place 2 files attached to this post in the override directory:
- RNDTREAS.2DA (copy of the vanilla file with additional rows added)
- RNDTRE13.ITM (just a dummy file that is replaced with random loot)
Now start a new ToB game with any character and type in the console:
C:CreateItem("RNDTRE13",1)
repeat it few times. As you can see you will always receive items from the "WELL_OFF" row instead of those from "RICH_13" row (1 is skipped, so the engine chooses row 3, not 13).
Sorry, i mixed up the 2 names. It is rndtres.2da that's used by icewind.
Here is how it works:
rndtres.2da doesn't need items that follows the 2da name and points to row number like I explained in the first post. Instead of this awkward implementation engine now checks the item name that will be replaced with random loot directly in the rndtres.2da (first column). You can choose any 8 character name, so it's possible for modders to use this 2da without any conflicts, as long as they add rows with unique names (for example using mod's prefixes). It is not limited to 99 rows (just tested it with row named TESTITM1, placed as a 130th row and dummy item named TESTITM1.ITM). @CrevsDaak awesome news indeed.
I will post it also on IESDP forums, as it opens up new possibilities for modders.
edit: another test with row name "TEST_" also spawned correctly, so yep, item names are not restricted whatsoever.
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!
Definitely Item Randomizer (Randomiser) mod could be re-written using this
Doing away with that for random treasure tables is an improvement. Still, item randomiser used placeable treasures besides the drop treasures now that I think about it. Even still, this could make Carsomyr drop from Dragon A, B, C or another high level monster for example.