Adding the probabilities of multiple outcomes in AnyDice

I don't know if this has been answered before. I've certainly looked for similar questions for a few hours, but even if I find similar ones, I still cannot work out the answer to this problem.

In a game you could have various outcomes: fail is 3-9, low success is 10-14, high success is 15-17, critical success is 18.

Let's say that you could also add a modifier to your dice roll so that a 3d6 could go below 3 or above 18.

So a 3d6 with the dice results added give the following probabilities: for { 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18} we get { 0.46, 1.39, 2.78, 4.63, 6.94, 9.72, 11.57, 12.50, 12.50, 11.57, 9.72, 6.94, 4.63, 2.78, 1.39, 0.46 }

How can I get the probabilities for the four success groups? Example: for { <=9, (>=10 & <=14), (>=15 & <=17), (>=18)} we get { (0.46 + 1.39 + 2.78 + 4.63 + 6.94 + 9.72 + 11.57), (12.50 + 12.50 + 11.57 + 9.72 + 6.94), (4.63 + 2.78 + 1.39), 0.46 }

So I would like the probabilities to be added and displayed as bars in the graph. Is this possible with AnyDice?

You'll need to use a function to map your dice to results. I've written that program here.

The success function here takes your dice roll and uses conditional blocks to check the range the number is in.

function: success A:n {
if A <= 9 { result: 0 }
if A >= 10 & A <= 14 { result: 1 }
if A >= 15 & A <= 17 { result: 2 }
result: 3
}

output [success 3d6] named "3d6"
output [success 3d6+5] named "3d6+5"
output [success 3d6+8] named "3d6+8"
output [success 3d6+17] named "3d6+17"

In this output $$\0\$$ marks a fail, $$\1\$$ a low success, $$\2\$$ a high success, $$\3\$$ a critical success: Making it easier to experiment with the ranges

In case you want to mess with the ranges a lot, the below version of the function will let you adjust the ranges themselves easily enough by passing the minimum scores of low, high, and critical successes to the function.

In your scenario the minimum score for a low success is 10, the minimum for a high success is 15, and the minimum for a critical success is 18, so below I call [success 3d6 at 10 15 18]. I also output another roll (plus modifier) with slightly easier ranges to show you another way you could call the function.

function: success A:n at LOW HIGH CRIT {
if A < LOW { result: 0 }
if A >= LOW & A < HIGH { result: 1 }
if A >= HIGH & A < CRIT { result: 2 }
result: 3
}

output [success 3d6 at 10 15 18] named "3d6 with standard ranges"
output [success 3d6+2 at 8 13 17] named "3d6+2 with easier ranges"
• Awesome! Thank you very much! I was beginning to work my way towards this, but I had no idea how to parametrize it. Sep 7 '21 at 12:19

Modifier on the horizontal axis

Here's a method that puts the modifier on the horizontal axis.

output 10-3d6 named "fail vs. low"
output 15-3d6 named "low vs. high"
output 18-3d6 named "high vs. critical"

Then use "At Most" and treat the result as a stacked area graph rather than a line graph. Each vertical slice gives the chance of rolling each of the four degrees of success for a given modifier. The four labels correspond to the areas between the curves, which I manually colored in for clarity.

Why this works

Let's take the first series, fail vs. low success, as an example.

• You need a total of at least 10 to get at least a low success.
• The die roll of 3d6 will make up part of this total.
• Therefore, you can phrase this problem as rolling 10-3d6 and comparing the resulting needed modifier to get at least a low success vs. your actual modifier. You get at least that degree of success if that needed modifier is at most your actual modifier.

Repeating for the other two thresholds gives us the three series.

Then, we need to go from the chance of (for example) getting at least a low success to the chance of getting exactly a low success. This is the chance of getting at least a low success but not getting at least a high success, which is just the difference between the two since one is a subset of the other. On the graph this is equal to the vertical distance between the two adjacent series. The same holds for the other intermediate areas.

Therefore treating the graph as a stacked area graph gives the desired result.