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

Emulating Exploding Dice With Different Sizes

March 10 (3 weeks ago)

I want to create or simulate an in-line roll that rolls 1d8, and on a roll of 8 additionally rolls 1d4. This is similar to an Exploding Die roll, with the exception that the exploded die is of a different size than the exploding die. 

Currently, I have simulated this with a rollable table that has 4 values for every number 1-7, as well as 1 value for each of 9, 10, 11, and 12. While this is sufficient for my current needs, if I need to generalize this behavior in the future, I do not want to have to create a rollable table for every combination of dice (i.e. d12+d10, d12+d8, d12+d6...)

I am the game owner of the game where this is relevant and have access to scripts if they are absolutely necessary, but I would like to stick with solutions using dice roll syntax if such solutions exist, regardless of complexity. 

You can mimic a single d8 into a d4 using

[[ { {d8=8}*(8+d4),d(8-1)}k1 ]]

You can replace the 8's and 4's to change it into any dice combo. However if you need to roll more than a single die you have to add the groups together such as:

[[ { {d8=8}*(8+d4),d(8-1)}k1 + { {d8=8}*(8+d4),d(8-1)}k1 ]]

There is an open suggestion for Custom Dice Syntax that could handle rolling a group multiple times with ease, so consider voting for it.


As an alternative if you don't mind being restricted to /roll and /gmroll commands is

/roll (?{Dice Count|1}-[[?{Dice Count}d8=8]])d(8-1) + 8*$[[0]] + $[[0]]d4

again just replace the 8's and 4's to provide other dice combos

March 10 (3 weeks ago)

Edited March 11 (3 weeks ago)
GiGs
Pro
Sheet Author
API Scripter

Also, as a pro user you have access to scripts, and using something like ScriptCards you could do this in a way that handles any die type simply.


While RainbowEncoder's excellent code shows it can be done without using a script, the dice system isn't really designed for this and you have to force it to comply.

March 11 (3 weeks ago)


RainbowEncoder said:

You can mimic a single d8 into a d4 using

[[ { {d8=8}*(8+d4),d(8-1)}k1 ]]

Oh man, this is gorgeous and pretty much exactly what I was hoping was possible. 

I've got the dice reference up as I type this, wanting to make sure I understand this query. I believe:

  • Boolean expression of a Compare Point
    • returns 1 if the d8 is equal to 8
    • if not, returns something less than 1 (whether 0 or -1)
  •  multiply this value by 8+1d4
    • Resulting in 8+1d4 if the Compare Point was met
    • Or something less than 1 (by negating the value or multiplying it by 0, depending on the implemented behavior of the Compare Point)
  • Separately roll a d8 that cannot land on 8 (handled by making the die size 1 less than the number used as Compare Point)
  • Keep the highest value between Bullet 2 and Bullet 3


This is... Genius, and you have both my thanks and that of an ecstatic player!

So, for posterity I believe a general form would be 

X=initial die size
Y=additional die size

{ {dX=X}*(X+dY),d(X-1)}k1

I've also thrown my voice at the suggested idea you pointed me towards - that would not only have provided another avenue for solving this, but it would also have solved a problem I had last week as well. Thank you, again, for this as well!

Cl B. said:

Oh man, this is gorgeous and pretty much exactly what I was hoping was possible.

I've got the dice reference up as I type this, wanting to make sure I understand this query. I believe:

  • Boolean expression of a Compare Point
    • returns 1 if the d8 is equal to 8
    • if not, returns something less than 1 (whether 0 or -1)

It's not a boolean expresion but a target number, it counts the number of dice that hit that target, it does return 1 on a rolled 8 otherwise it's 0

  •  multiply this value by 8+1d4
    • Resulting in 8+1d4 if the Compare Point was met
    • Or something less than 1 (by negating the value or multiplying it by 0, depending on the implemented behavior of the Compare Point)

Yep, this results in the either a value of an exploded die roll or 0 if roll doesn't explode

  • Separately roll a d8 that cannot land on 8 (handled by making the die size 1 less than the number used as Compare Point)
  • Keep the highest value between Bullet 2 and Bullet 3

Also correct