Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

[Script] Weighted Dice: Automated Rollable Table creation with proper statistical distribution for minimum rolls.

June 22 (11 years ago)

Edited August 19 (3 years ago)
The Aaron
Pro
API Scripter

Update v0.2 -- Fixed off by one error in setting up the range of the table.

My GM rolls his dice with a minimum, but wants the statistical distribution to be correct. I threw together this script for him to use to create rollable tables for the dice:

!weighted-die 12 8
This creates a rollable table named d12min8 (if it doesn't exist already) with 5 entries:
  • 8 with a weight of 8
  • 9 with a weight of 1
  • 10 with a weight of 1
  • 11 with a weight of 1
  • 12 with a weight of 1
Which can then be rolled as
/r 8t[d12min8]
Git: https://github.com/shdwjk/Roll20API/blob/master/WeightedDice/WeightedDice.js



If you use my scripts, want to contribute, and have the spare bucks to do so, go right ahead. However, please don't feel like you must contribute just to use them! I'd much rather have happy Roll20 users armed with my scripts than people not using them out of some sense of shame. Use them and be happy, completely guilt-free!
Disclaimer: This Patreon campaign is not affiliated with Roll20; as such, contributions are voluntary and Roll20 cannot provide support or refunds for contributions.

June 22 (11 years ago)
Lithl
Pro
Sheet Author
API Scripter
What's the real use-case here? Wouldn't it be simpler to use /r {d12,8}kh1?
June 22 (11 years ago)
The Aaron
Pro
API Scripter
hmm.. maybe... Can you roll multiple of those d12s that way, the equivalent to /r 10t[d12min8] ?
June 22 (11 years ago)
The Aaron
Pro
API Scripter
For that matter, I keep getting:
Cannot mix sum and M rolls in a roll group
When I try that expression.
August 11 (11 years ago)
The Aaron
Pro
API Scripter
Fixed an off by one bug.