6
\$\begingroup\$

I've been trying to use AnyDice to calculate some stuff and got completely overwhelmed (never used it properly before).

I'm trying to do something along the lines of:

Roll n + p amount of d10 dice. If any of those result in 1, check for each 1 roll 1d10 + p.

In this sequence I'm trying to see what are the odds that at least one of the dice will result in 1 and what would the secondary roll result spread would be.

Is it possible to do something like this? Because I'm already failing at trying to compare the dice to a number and assigning variables does not seem to help. I think I jumped into something too complex for a first more serious use of the system.

EDIT: Basically the first roll is for casting a spell and 1s represent mishaps. For each 1 you roll onto table which has 10 entries (the higher the number, the more severe result). Adding extra dice p (pushing) makes those table results worse. I want to see how quickly and how bad that can go. If I add 1 extra die, what's the chance to get a mishap and how bad, if i add 2, etc (apologies if too much details, not sure how else to clarify this).

So far I managed to count number of 1s (i think)

function: hitme N:n plus P:n {
  X: N + P
  result: [count {1} in X d10]
}
output [hitme 4 plus 2]

EDIT2:

You guys are right. I think I was over-complicating the issue. The second half is indeed very straightforward (simple roll with static number value addition). The first one was the real issue.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ Given that the outcomes from a mishap are based on rolling on a table, what kind of results do you expect to get from this analysis? \$\endgroup\$
    – Mark Wells
    Mar 16, 2020 at 19:11
  • \$\begingroup\$ Based on how much extra dice I add output [hitme 4 plus 2] output [hitme 4 plus 3] etc To see what's the chance of rolling 1s (like 20% to roll one 1) and then what are the chances to get which values on the second roll (having in mind that it will have a static modifier) \$\endgroup\$
    – NulisDefo
    Mar 16, 2020 at 19:16
  • 4
    \$\begingroup\$ I'm still not sure what you mean by "chances to get which values on the second roll". If the second roll uses N-sided dice, the chance to get any value is 1/N each time you roll on the table. The only effect of the static modifier is to change which set of outcomes you can get. \$\endgroup\$
    – Mark Wells
    Mar 16, 2020 at 19:43
  • 1
    \$\begingroup\$ A simpler (and faster) way to write your function above is just (N + P)d(d10 = 1). But I'm still not sure what you want to do with the result after that. Could you try to describe that part of your mechanic more clearly, more or less like if you were explaining it to your players? \$\endgroup\$ Mar 16, 2020 at 19:56
  • 1
    \$\begingroup\$ Welcome to RPG.SE! Take the tour if you haven't already, and check out the help center for more guidance. Relevant meta: Don't signal your edits in text. Instead, you should edit your answer to read as if it were always the best version of itself; anyone interested in older versions can view the revision history. \$\endgroup\$
    – V2Blast
    Mar 17, 2020 at 5:07

2 Answers 2

9
\$\begingroup\$

Forget anydice; this is analytically trivial

What you are describing is a Binomial distribution with parameters (as per the Wiki page notation) of \$p=0.1\$, \$q=0.9\$ and \$n=\text{your }n+\text{your }p\$.

You can read through the details of how to determine the chance of any particular number of fails [the probability mass function] or at least any given number of fails [the cumulative distribution function]. Both Excel and Google sheets have built in functions for both.

Knowing the distribution of this random variable, you can combine it with the second (\$1d10+ \text{your }p\$) to get any numerical result you like. However, it appears that you are using a table for “mishaps - if these are something other than numbers then maths can’t help.

That said, you can build this Binomial distribution in anydice. Like this:

output (N+P)d{1:1, 0:9}

There is one scenario I would like to cover. Those dice that do result in one. Let's say we reroll them once. What's the chance that we still get a 1? That would cover all in my interest on the subject. Though that would probably just nesting the same function, i assume

More or less:

output (N+P)d{1:1, 0:9}d{1:1, 0:9}
\$\endgroup\$
5
  • \$\begingroup\$ There are a lot of equations on the linked wiki. This could benefit by some explanation of which parts of the wiki are relevant (probably Expected Value and Variance?). Also, could you name the Excel/Sheets function(s) that do this, for completeness? Otherwise, frame challenge answer. \$\endgroup\$
    – Ifusaso
    Mar 16, 2020 at 20:09
  • \$\begingroup\$ You seem to be just calculating the same thing as the code the OP already has, i.e. the number of ones rolled on N + P d10s. Your answer doesn't address whatever the OP wants to do with that number (which is understandable, since the OP hasn't explained it clearly yet, but it still makes your answer incomplete). \$\endgroup\$ Mar 16, 2020 at 20:19
  • 1
    \$\begingroup\$ There is one scenario I would like to cover. Those dice that do result in one. Let's say we reroll them once. What's the chance that we still get a 1? That would cover all in my interest on the subject. Though that would probably just nesting the same function, i assume \$\endgroup\$
    – NulisDefo
    Mar 16, 2020 at 21:56
  • \$\begingroup\$ Do you mind explaining the syntax? \$\endgroup\$
    – NulisDefo
    Mar 17, 2020 at 13:45
  • \$\begingroup\$ @NulisDefo: {1:1, 0:9} is a list containing a single 1 and nine 0s. When used as a die, it represents a ten-sided die with one side marked "1" and all other sides marked "0". (FWIW, another way to get such a relabeled d10 in AnyDice is with (d10 = 1), since comparison operators in AnyDice return 1 for true and 0 for false.) (N+P)dX returns the distribution of the sum of N+P rolls of the die X. Further, (N+P)dXdX (which gets parsed as ((N+P)dX)dX) returns the distribution obtained by rolling (N+P)dX, and then rolling dX again that many times. \$\endgroup\$ Mar 17, 2020 at 19:46
2
\$\begingroup\$

It might just be a pure maths problem, so you don't need AnyDice.

If you want to know what the chances are of rolling a dice twice in a row, you multiply 1/N times 1/N, where N is the number of sides on the die: e.g. chances of rolling two 20s in a row with a d20 are 1/20 times 1/20, equals 1/400, or 0.25%.

You seem to be basing it on a d10 roll though, so here it goes:

  • The chances of rolling a 1 once on a d10 is 1/10, or 10%;
  • The chances of rolling a 1 twice in a row on a d10 is (1/10 times 1/10) 1/100, or 1%;
  • The chances of rolling a 1 three times in a row on a d10 is (1/10 times 1/10 times 1/10) 1/1000, or 0.1%;
  • and so on.

So if rolling three 1s in a row means that something catastrophic happens, then that is a 1 in a thousand chance.

If you don't like the odds, then just use a d20, where rolling three 1s in a row has only a 1/8000 chance of happening, or 0.0125%.

I hope this helps to make the tables you intend.

If you want spell "mishaps" to be rare I would use a d100 or percentile dice, this way you control this better. For example, 1-5 on a d100 equals a mishap. Then have a further table to determine the type of mishap; again a d100 gives you flexibility. For instance, if you roll 1-7, you turn into a Giant Frog for 1 minute MM p.325. You can have a lot of fun with this.

The DM in my current campaign has a similar system, where you role d20 to determine if something odd might happen. On a 1, something odd happens and then you roll a percentile die (d100) to determine what happens. I grew a second set of ears once, and had advantage on Wisdom (Perception) checks to do with my hearing, it lasted 1d100 hours.

\$\endgroup\$

You must log in to answer this question.

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