I'm messing around trying to create treasure tables. Using the 5E DMG as an example, a treasure hoard may contain 2d6 Gems each priced at 50 gp. They also have a table of 12 different gems, each worth 50 gp. At the moment I only know how to either pull 2d6 unique gems (using a deck) or just pick one gem from a table and say you find 2d6 of them.
Is there an established method, or example, of how to pull quantities from a deck that add up to a given total? For instance:
[2d6] = 9 Total Gems => [1d4]=3x Gem A, [1d4]=2x Gem E, [1d4]=4x Gem D.
I'd imagine you'd need to use recursion but I'm not having any luck getting it to work. Is there a better way?
Thank you!
Comments
http://www.nbos.com/forums/viewtopic.php?f=16&t=986&sid=f864757be3ab22f532a4b3f2c3124eb7
Example results:
1 opals, 3 sapphires, 3 diamonds, 2 emeralds, 1 rubies
4 sapphires, 2 diamonds, 1 rubies
2 opals, 1 rubies, 1 emeralds
3 rubies, 2 opals, 1 sapphires
1 diamonds, 1 opals, 2 emeralds, 2 sapphires, 1 rubies
Hi, this is very similar to something I am trying to do and I pasted the exact code and I get this as results:
[@10 Gems >> each AddToHash][@&;#91;@HashCount&;#93; HashKeys >> each ShowResults >> implode]
[@7 Gems >> each AddToHash][@&;#91;@HashCount&;#93; HashKeys >> each ShowResults >> implode]
[@10 Gems >> each AddToHash][@&;#91;@HashCount&;#93; HashKeys >> each ShowResults >> implode]
[@5 Gems >> each AddToHash][@&;#91;@HashCount&;#93; HashKeys >> each ShowResults >> implode]
[@6 Gems >> each AddToHash][@&;#91;@HashCount&;#93; HashKeys >> each ShowResults >> implode]
I noticed my install didn't put a Hashes.ipt in common/nbos/. Where do I get that file?
Thanks!