Skip to content

[BG(2):EE] Expanded random tables from IWD:EE

switswit 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:

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.
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.

@Avenger_teambg
Musigny

Comments

  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    I'm pretty sure this engine or the next will work (or already working) exactly like IWDEE.
    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.
    MusignyJuliusBorisovCrevsDaak
  • switswit Member, Translator (NDA) Posts: 495
    edited March 2015
    @Avenger_teambg yep, I tested it on the latest BG2:EE patch v1.3.2064 with rndtreas.2da.

    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).
  • switswit Member, Translator (NDA) Posts: 495
    file attached to this post
  • Avenger_teambgAvenger_teambg Member, Developer Posts: 5,862
    Alright, now repeat your test with rndtres.2da :)

    Sorry, i mixed up the 2 names. It is rndtres.2da that's used by icewind.
    CrevsDaakswitJuliusBorisov
  • CrevsDaakCrevsDaak Member Posts: 7,155
    Whooohooo! Awesome news!
    MusignyJuliusBorisov
  • switswit Member, Translator (NDA) Posts: 495
    edited March 2015
    Good job @Avenger_teambg on this one. This is actually even better than the implementation that I've requested, as it is not limited to 99 rows and can fully replace rndtreas.2da, rndequip.2da, rndmagic.2da, rndscrol.2da, rndwep.2da for modders.

    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.
    Post edited by swit on
    elminsterCrevsDaakJuliusBorisovAstroBryGuy
  • argent77argent77 Member Posts: 3,431
    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!
    smeagolheartmf2112
  • smeagolheartsmeagolheart Member Posts: 7,963
    has this been implemented in any mods?

    Definitely Item Randomizer (Randomiser) mod could be re-written using this
  • argent77argent77 Member Posts: 3,431
    I don't think the randomiser uses treasure tables at all. However, it looks like SCS uses a couple of random treasure tables incorrectly by using two-digit numbers for the placeholder treasure item. Although I'm not certain whether they are only installed when TobEx is available (which adds support for two-digits treasure items).
  • smeagolheartsmeagolheart Member Posts: 7,963
    argent77 said:

    I don't think the randomiser uses treasure tables at all. However, it looks like SCS uses a couple of random treasure tables incorrectly by using two-digit numbers for the placeholder treasure item. Although I'm not certain whether they are only installed when TobEx is available (which adds support for two-digits treasure items).

    It doesn't it places items via a script as soon as you start a new game. So back in the day when you started a game, it would freeze for a bit and you couldn't leave the area before the script was finished or things would mess up.

    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.
  • The user and all related content has been deleted.
Sign In or Register to comment.