Skip to content

Possible to create very rare drops?

noTime666noTime666 Member Posts: 20
edited March 2 in General Modding
I’ve been tinkering with RNDTRES.2DA and trying to chain random items to create a very low-probability drop. Normally, doing a single d40 roll (2.5%) is easy, but I want to go even lower than that. Chaining random items more than once doesn’t seem to work - I guess it’s an engine limitation.

In theory, this should create 1/40 * 1/40 probability (0.0625% or one in 1600 rolls). Unfortunately, it doesn't work. It works when RNDMELE2 is omitted and RNDMELE1 points directly to RNDMELEE, but that's 2.5% chance.
2DA V1.0
*

           1         2         3         4         5         6         7         8         9         10        11        12        13        14        15        16        17        18        19        20        21        22        23        24        25        26        27        28        29        30        31        32        33        34        35        36        37        38        39        40
RNDMELE1   RNDMELE2  *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         
RNDMELE2   RNDMELEE  *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         *         
RNDMELEE   AX1H02    AX1H19    BLUN03    BLUN05    BLUN07    BLUN10    BLUN36    BLUN38    BLUN41    DAGG02    DAGG09    HALB02    HAMM02    HAMM04    SPER02    SW1H02    SW1H03    SW1H05    SW1H08    SW1H22    SW1H24    SW1H44    SW1H47    SW1H49    SW1H79    SW2H02    RLBLUN05  RLHALB02  RLSPER02  RLSTAF02  RLSW1H22  RLSW1H02  RLSW1H44  RLSW1H47  RLSW1H49  RLSW1H49  RLSW1H49  RLSW1H49  RLSW1H49

Are there other workarounds? Other than creating 40 dummy random items for each weapon separately, of course.

Edit: hmmm, I think I misunderstood what * means here. It’s not "no item" - if * is rolled, it actually makes it fall back to any existing item in the row, which increases the probability all the way to 100%. What I actually meant (no item) is probably DW#BLANK.
Post edited by noTime666 on

Comments

  • sarevok57sarevok57 Member Posts: 6,101
    so from my experience with editing treasure tables is that the game favors stuff more in the middle. so for example if you had a line in the rndmag table and on slot 20 you had rndscr01, and then in the rndscr01 table on slot 20 you put your "super rare item" and might take 1000+ tries before you ever see it

    so items that you want to appear more often put them more in the middle of your tables ( 8, 9, 10, 11, 12 ) and items you want to be more rare, make sure they go on the outside slots ( like 1,2,19,20 )

    out of all the RNG that is in the these games, for whatever reason, the treasure tables are "the worst" when it comes to; something "should" happen once every 20/40 times
  • jmerryjmerry Member Posts: 4,205
    edited March 4
    Depends on which random treasure table you're looking at. RNDWEP and RNDSCROL tables use a uniform distribution (roll 1d20). RNDEQUIP*, RNDMAGIC, and RNDTREAS tables use a triangular distribution (roll 2d10). Reference link.

    So, yes, an item on the outer edges of a RNDEQUIP, RNDMAGIC, or RNDTREAS table is particularly rare - 1/100 each time on that table. That's column 2 or 20 in RNDTREAS and RNDMAGIC, column 1 or 19 in RNDEQUIP**. But it's not quite what you thought was going on.

    *The random items on this table are unreachable in the unmodded game.
    **Yes, this table is bugged and column 20 has zero chance. A classic zero-impact bug.
  • noTime666noTime666 Member Posts: 20
    RNDTRES (not to be mistaken for RNDTREAS), which I’m using and which was ported to BGEE from Icewind Dale around 2015, also doesn’t seem to use a bell curve distribution. It has 40 columns (excluding the item name), so I'd assume it's a uniform distribution (1d40 roll).

    Two RNDxxx items in RNDTRES chained together can make 0.0625% so it's probably the lowest we can go.
    If the second item has 20/40 columns filled it's 1.25% to pick one of the filled columns. For my use case, that's probably sufficient. After all, we don't kill that many monsters in BGEE, it's still a pretty low chance.
  • GraionDilachGraionDilach Member Posts: 619
    edited March 4
    You can chain RNDTRES multiple times. That's not the problem. (I think RNDTRES can even be extended, atleast I haven't noticed any issues doing so.)

    The problem is that if your chaining breaks off somewhere for some reason, the dummy item which was never substituted with the final result is an undroppable unstealable blocked item slot (which isn't a problem for enemy creatures if you explicitly place it into their inventory, but can be a problem from containers).

    Unless that dummy item actually exists on the ITM level, because then that ITM will be used as-is.

    So due to this, it might also make sense to actually create your own "blank/dummy" item and make it unstealable, undroppable and all that, so that it's at least a valid one.
  • noTime666noTime666 Member Posts: 20
    You can chain RNDTRES multiple times. That's not the problem.
    I tried. You can chain random items not more than twice. The third item will resolve as empty item, even if everything looks correct. Try the table in my first post, if you don't believe me. I had all three RNDMELE1, RNDMELE2 and RNDMELEE dummy items.
  • GraionDilachGraionDilach Member Posts: 619
    edited March 4
    And I have mod components doing multichaining for 4 years.

    I know for a fact that multichaining works, because I worked a lot with this. Have you cloned RNDTRE01.ITM for your custom treasure entries? Because if not, then you literally run into the issue I explained - that you will need to ensure that the item name is legit between the steps.
  • noTime666noTime666 Member Posts: 20
    I installed your mod. These are the new entries in my override/rndtres.2da after installation:
    ZGTRWS1    BDSCRL1A   CDIA127    CDIA128    MISC28     POTN44     RING10     SCRL04     SCRL1E     SCRL1I     SCRL1L     SCRL2A     SCRL2D     SCRL59     SCRL5B     SCRL5I     SCRL5K     SCRL5P     SCRL6J     SCRL6L     SCRL6M     SCRL6U     SCRL77     SCRL84     SCRLA6     *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS2    BDSCRL2A   CDIA225    CDIA226    POTN15     POTN25     POTN30     POTN41     SCRL08     SCRL18     SCRL1N     SCRL1O     SCRL1T     SCRL1W     SCRL68     SCRL6D     SCRL6N     SCRL6R     SCRL73     SCRL78     SCRL7B     SCRL7D     SCRL83     SCRL89     SCRL93     *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS3    CDIA323    POTN28     POTN29     POTN39     RESTORE    RING16     SCRL03     SCRL07     SCRL11     SCRL16     SCRL1D     SCRL1F     SCRL1H     SCRL1M     SCRL1Y     SCRL2B     SCRL56     SCRL5G     SCRL5J     SCRL5W     SCRL62     SCRL69     SCRL6P     SCRL6Y     SCRL80     SCRL92     *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS4    POTN37     POTN43     RING14     SCRL15     SCRL1J     SCRL1P     SCRL1Z     SCRL2F     SCRL5D     SCRL5E     SCRL5L     SCRL5M     SCRL5N     SCRL5Q     SCRL5T     SCRL6V     SCRL6W     SCRL71     SCRL72     SCRL75     SCRL85     SCRL90     *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS5    CDIA524    POTN23     SCRL05     SCRL06     SCRL10     SCRL12     SCRL17     SCRL1B     SCRL1U     SCRL1X     SCRL3H     SCRL5C     SCRL61     SCRL6G     SCRL6I     SCRL6K     SCRL6X     SCRL70     SCRL79     SCRL7C     SCRL81     SCRL82     SCRL86     SCRL8X     *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS6    SCRL7E     SCRL7F     SCRL7G     SCRL7H     SCRL7I     SCRL7J     SCRL7K     SCRL7L     SCRL7M     SCRL7O     SCRL7P     SCRL7Q     SCRL7R     SCRL7S     SCRL7T     SCRL7V     SCRL7W     SCRL7X     SCRL7Y     SCRL7Z     SCRL8A     SCRL8B     SCRL8C     *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS7    *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS8    CDIA806    SCRL1K     *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS9    CDIA901    CDIA904    SCRL5A     SCRL5U     *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS1M   ZGTRWS1    *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS2M   ZGTRWS1    ZGTRWS2    *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS3M   ZGTRWS1    ZGTRWS2    ZGTRWS3    *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS4M   ZGTRWS1    ZGTRWS2    ZGTRWS3    ZGTRWS4    *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS5M   ZGTRWS1    ZGTRWS2    ZGTRWS3    ZGTRWS4    ZGTRWS5    *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS6M   ZGTRWS1    ZGTRWS2    ZGTRWS3    ZGTRWS4    ZGTRWS5    ZGTRWS6    *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS7M   ZGTRWS1    ZGTRWS2    ZGTRWS3    ZGTRWS4    ZGTRWS5    ZGTRWS6    ZGTRWS7    *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS8M   ZGTRWS1    ZGTRWS2    ZGTRWS3    ZGTRWS4    ZGTRWS5    ZGTRWS6    ZGTRWS7    ZGTRWS8    *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS9M   ZGTRWS1    ZGTRWS2    ZGTRWS3    ZGTRWS4    ZGTRWS5    ZGTRWS6    ZGTRWS7    ZGTRWS8    ZGTRWS9    *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    

    I see two chained random items, but nothing longer.
    I.e. ZGTRWS9M (random) -> ZGTRWS1 (random) -> SCRL04 (resolved final item)
    Analogical setup works for me as well.

    My point is that above 2 random items it doesn't work:
    ZGTRWS9M -> ZGTRWS1 -> ZGTRWS8M (resolved empty item instead of randomizing third time) -> SCRL04

    Btw. how does the game know that ZGTRWS9M is a random item that should be resolved from RNDTRES.2DA? I thought it needs to begin with RND...
  • jmerryjmerry Member Posts: 4,205
    edited March 4
    Hmm ... the IESDP says this:
    Placeholder item names defined in RNDTRES.2DA will just create empty item entries (circular loops are not possible)

    So, @GraionDilach , is that (from the RNDTRES.2DA page) something that needs a correction? If I'm understanding correctly, you say that RNDTRES tokens can be chained if [tokenid].itm exists in the game files? (Wouldn't be the only thing on that page which needs a correction - the stuff about d20 versus 2d10 rolls on the other tables is definitely wrong.)
    noTime666 wrote: »
    I thought it needs to begin with RND...
    The other random treasure tables have defined RND***## token names, regardless of what's in the first column. RNDTRES allows arbitrary token names defined in the first column, though the base game only uses names starting with RND.
  • GraionDilachGraionDilach Member Posts: 619
    edited March 4
    Any itemname can be listed in RNDTRES.2DA, that's why it's a separate logic.

    Why are the potions detected as spells there though?! Did you made an edit to them?

    EDIT: I'll do another check, but I do think the ITM files can be used for further chaining, because they allow redropping the item and that dropping an item/spawning the container step triggers the random logic.

    EDIT2: Come to think of it, the visible limitation might be spawning triggers it once, kill/drop triggers second layer and then you just go forward with manual ITM steps.
  • noTime666noTime666 Member Posts: 20
    Why are the potions detected as spells there though?! Did you made an edit to them?
    Yes, you can ignore that, I was playing with WeiDU's COPY_RANDOM on that installation and mixed some potions with scrolls, among other things.
    Any itemname can be listed in RNDTRES.2DA, that's why it's a separate logic.
    I see - so this means every item is checked to determine whether it exists in RNDTRES.2DA, interesting.

    It's also worth noting that while .cre can have multiple RNDTREAS references (or RNDEQUIx#, RNDMAG0#, etc.), only a single RDNTRES token is respected. So i.e. if a creature has ZGTRWS8M and ZGTRWS9M items, only the earlier one on the list will be resolved. This is something I haven't seen explained anywhere and had to learn the hard way myself.
  • GraionDilachGraionDilach Member Posts: 619
    edited March 5
    Again, are you actually setting up the ITMs? Because that's another thing which I haven't seen happening and I'm using all 8 components of mine doing so.

    If the randomization fails, you still get the ITM itself and you can make that droppable/redropping manually to fix it. In fact, because randomization doesn't happen in STO files (stores/bags), RGT 10000 outright respecifies every random treasure to ensure they can be dropped to allow manual retriggering.
  • noTime666noTime666 Member Posts: 20
    edited March 7
    The thing is, in your mod you're not doing exactly the same thing as I'm trying to do.
    I assigned ZGTRWS7M and ZGTRWS8M to an ogre.cre - indeed, it works, every ogre drops two random scrolls.

    BUT if I extend the randomization chain and add two new random items to RNDTRES.2DA, both pointing to ZGTRWS7M and ZGTRWS8M:
    ZGTRWS7N   ZGTRWS7M    *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    ZGTRWS8N   ZGTRWS8M    *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *          *
    
    (I've created override/ZGTRWS7N.ITM and override/ZGTRWS8N.ITM by copying it from override/ZGTRWS7M)

    As I stated before, the chain will exceed two random items and thus the ogre will drop two invalid items. There is no possibility these new random items are invalid, since I've copied them from your ZGTRWS7M.ITM.

    There is also no way to prevent dropping an item if one is using chained random items. SCS uses a workaround with DW#BLANK, but it works only for resolving the first random item. In second random item DW#BLANK is resolved as empty/invalid, even though other items work.

    I don't understand what you mean by "RGT 10000" and "manual retriggering", can you elaborate?
  • GraionDilachGraionDilach Member Posts: 619
    edited March 7
    In that very same mod you're looking at, there is component 10000. That has these blocks - https://github.com/GraionDilach/RandomGraionTweaks/blob/master/zgtweaks/zgtweaks.tp2#L1031-L1067 & https://github.com/GraionDilach/RandomGraionTweaks/blob/master/zgtweaks/library/spilling.tpa#L249-L256 - which basically convert all random treasure dummy items into oIWD1 Identify scrolls. So you can pick them up, throw them to the ground and that should continue progressing the chain. (TBH those changes are purely cosmetic, but still dropping to the ground and picking it up again should work.)
  • jmerryjmerry Member Posts: 4,205
    edited March 7
    A bit of testing ... one step at a time. Any of the following will progress the chain of RNDTRES tokens exactly one step:
    - Enter the area the token is in or spawn in the non-party creature it's on.
    - Load a save with the token in the party's inventory or in the active area.
    - Move the item to a container or ground pile.

    Note that a token in a container will normally be processed once before you pick it up, while a token on a creature will normally be processed twice - once when the creature spawns in, once when you kill it and the token/item drops to a ground pile.

    (Testing procedure: I created a chain of ten tokens, placed the top token of the chain in the haystack, and messed around in the prologue with a fresh character.)
Sign In or Register to comment.