3
\$\begingroup\$

I am trying to model some probabilities for a pretty basic tabletop RPG mechanic. I have been searching for two days and trying to make this work myself, but my function-fu is weak, so I seek the aid of the masters.

Here is the situation:

First: ATTACKER fires a gun, rolling 1d10 and adding STAT. -- If he meets or exceeds TARGETNUMBER he has hit the target and rolls again to wound.

Next: If Model scores a hit, he makes an opposed roll!

-- ATTACKER now rolls 1d10 and adds WPNSTR

-- DEFENDER rolls 1d10 and add DEF

---- If ATTACKER's roll meets or exceeds DEFENDER's roll, he is successful, and DEFENDER takes a wound.

I've been able to calculate this with a very basic formula using fixed stats, here (AIM 4, TN10, STR7, DEF6):

function: shootwound SHOT:s on HIT:n to WOUNDROLL:d {
    if [SHOT contains HIT] {
        result: WOUNDROLL
    }
        
    result: -1
}


output [shootwound {6..10} on d10 to (d10+7)] >= (1d10+6) named "Chance for an AIM 4 model to take a DEF 6 model out-of-action by shooting him with a rifle"

This works well enough, provided I manually change the numbers in the formula when I want to change variables. It's ugly, but gets me the answer I am looking for.

Here is where I have hit a brick wall:

Some weapons will let you shoot multiple times! For instance, an Assault Rifle allows two shots. It seems obvious that the odds should be better, and it's not as simple as "Well, shooting twice should double your odds!" because when rolling two dice, you have a chance to score two successes! I've got a basic probably of the number of hits you are likely to generate (assuming the same AIM4 and TN10) firing twice here:

output [highest 2 of 2d{0,1}]

So now, when shooting twice, there is a likelihood of scoring 0, 1, or 2 hits (25%-50%-25%, respectively).

I have not been able to figure out how to incorporate this distribution into the first formula.

I would appreciate any bumps in the right direction here, and any tips to make this work with changeable variables.

Thanks!

\$\endgroup\$

1 Answer 1

5
\$\begingroup\$

The most concise way is to use the comparison operators. The >= operator produces a 1 if the left side is greater or equal to the right side, and a 0 otherwise. So, for example, the rolls to hit and to wound could be expressed as

TO_HIT: d10 + AIM >= TN
TO_WOUND: d10 + STR >= d10 + DEF

Then, to compute the probability of both succeeding on the same attack, we can multiply the results:

TO_HIT * TO_WOUND

The logical AND operator & will do the same thing in this case. However, multiplication can be useful in this type of conditional since you can put a boolean on one side and an integer on the other, e.g. if you dealt d6 wounds instead of one.

Finally, to roll multiple attacks and compute the total number of wounds dealt, we can use the d operator:

output ROFd(TO_HIT * TO_WOUND)

Link to AnyDice.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Wow. This is SO MUCH easier than I was making it out to be in my head... Thank you x1000 \$\endgroup\$ Commented Mar 18 at 0:33

You must log in to answer this question.

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