2
\$\begingroup\$

So I'm exploring some mechanics and I want to use Exploding Rolls, similar to Savage World, but I'm curious about the statistics of also having an exploding difficulty.

For example:

I roll 1d6 and 1d8, both can explode but I keep the highest result vs 1d4 for difficulty (this dice would raise to fit more difficult situations, like 1d6, 1d8 etc).

I'm having trouble to come up with a system so I can compare different skill dices and difficulty dices.

\$\endgroup\$

2 Answers 2

6
\$\begingroup\$

So far...

You know the code for the function without exploding dice.

Part 3 explode

You need to tell your code that the dice do explode, which is part of the explode function. with proper brackets in the comparison, so for example [highest of [explode 1d4] and [explode 1d8]] to have skill dice explode or [explode 1d6] to have a single d6 explode.

Adapted code

SKILL_A: 1d4
SKILL_B: 1d8
DIFF: 1d6

function: sign of N:n {
  if N < 0 { result: -1 }
  if N > 0 { result: 1 }
  result: 0
}

output [sign of [highest of SKILL_A and SKILL_B] - [explode DIFF]] named "1 = higher, 0 = equal, -1 = lower"

or with comparison: here

\$\endgroup\$
8
\$\begingroup\$

You can use the same solution(s) as for your previous question, but wrap the rolls you want to explode with the [explode DIE] function from AnyDice's built-in Function Library, e.g. like this:

function: sign of N:n {
  if N < 0 { result: -1 }
  if N > 0 { result: 1 }
  result: 0
}

SKILL_A: d4
SKILL_B: d8
DIFF: d6

output [sign of [highest of SKILL_A and SKILL_B] - DIFF] named "no explode (-1 = failure, 0 = tie, 1 = success)"

SKILL_A: [explode d4]
SKILL_B: [explode d8]

output [sign of [highest of SKILL_A and SKILL_B] - DIFF] named "only skill dice explode (-1 = failure, 0 = tie, 1 = success)"

DIFF: [explode d6]

output [sign of [highest of SKILL_A and SKILL_B] - DIFF] named "all dice explode (-1 = failure, 0 = tie, 1 = success)"

The [explode DIE] function takes any die and returns an exploding version of that die. So, for example, [explode d6] is an exploding d6. It does have a few notable quirks that should be kept in mind:

  • [explode 2d6] is a single 2d6 roll that explodes (i.e. gets another 2d6 roll added to it) on a roll of 12 (the maximum possible result). If you instead want to roll two d6's that each explode on a roll of 6, you need to write that as 2d[explode d6].

  • To keep the range of possible results limited, AnyDice by default only lets dice explode at most twice. You can adjust this limit with set "explode depth" to N, where N is some number (the default value being 2) if you want.

  • The [explode DIE] function always produces dice that explode on the highest possible roll, adding a reroll of the same die to the original roll. If you'd prefer to use some other explosion rule, you need to write your own custom function. There's an AnyDice blog post about exploding dice that goes into this in more detail.

\$\endgroup\$
2
  • \$\begingroup\$ it's more economous on the code to put the explodes in the output line than re-defining the dice \$\endgroup\$
    – Trish
    Feb 23, 2023 at 18:48
  • 1
    \$\begingroup\$ @Trish: Sure, but having too many nested functions can also become hard to read at some point. Variables are cheap and help readability. (Also, I was trying to drive home the point that the only thing the OP needs to change is the definition of the dice; the calculation is otherwise exactly the same whether the dice explode or not.) \$\endgroup\$ Feb 23, 2023 at 18:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .