Hi!

I would be pretty interested in a precise explonation of the rarity value of items and the algorithm used in the PopulateContainer and MightyRNG methods.

So far my observations are the following:

  • The PopulateContainer method randomizes the number of items spawned in the container.
  • With the MightyRNG method you randomize an item of the possible items in that container type. This is done for each itemslot.
  • If you happen to generate a duplicate, you retry until you get a non duplicate with a maximum retry count of 10.
  • The scrap amount is constant. You spawn exactly the given amount of scrap.
  • If someone wants a warrying amount of scrap he/she can add scrap to the containers ItemList.
  • This solution is not as good for randomized scrap spawn as it would be if you could set a min and max for the default scrap spawn as you can for the items in the ItemList. The scrap in a long ItemList won't get selected most of the time so you will be left with the constant amount of scrap in those containers opposed to the min max option where you would see a dispersion of the scrap amounts corresponding to the random generator used.
  • Rarity is an integer between 0 and 4 where 0 is the most common and 4 is the rarest category.
  • Rarity scales with the poweres of two so an item that has a rarity of 2 is twice as rare as an item with a rarity of 1.
  • The MightyRNG algorithm first randomizes what kind of rarity the item could be.
  • Then the algorithm selects the items for that container with the highest rarity that's not above the randomized rarity level.
  • At last the algorithm selects one of the items of that rarity level randomly.


My question regarding the randomization algorithm is the following:
Why don't use a single weight number for every item in every container? So you can exactly balance each item's probability for each container. If you set a rarity for an item now, that item will have that rarity in every container. If I want the players to be able to find an AK at a low probability in military (normal) crates but I also want the supply drop to spawn AK-s with a higher chance, I just can't do that right now. (maybe by adding multiple entry-s into the the supply drops ItemList but that's not an elegant solution in my opinion)

Don't get me wrong here. I think your plugin is awesome and I'm all happy for it :D I was just curious about these thing. Also I'm sort of thinking about creating a similar plugin with a bit more customization (like constraints for spawning weapons with a stack of ammo next to them or a constraint for the supply drop to spawn at least x amount of weapons etc.). I just don't want to reinvent the wheel.

Thanks for your reply!