# Modifiers

Modifiers are special flags that can change the value of dice rolls, their appearance, order, and more.

You can generally combine multiple modifiers of different types, and they'll work together.

For example, This will both Explode any maximum rolls, and Keep only the highest 2 rolls:

```
5d10!k2
```

Missing a modifier?

We have tried to cover all the commonly used modifiers. Let us know if we've missed one that you use!

Modifier order

Modifiers always run in a specific order, regardless of the order you specify them in. This is determined by the modifier's `order`

property, and works in ascending order.

These two are equivalent, and the explode modifier will always run before the drop modifier:

```
4d6!d1
4d6d1!
```

`min{n}`

)

Min (**Order:** 1

The min modifier causes any dice rolls below the minimum value to be treated as the minimum value. It's the opposite of the Max modifier

To specify a minimum value, use the word `min`

followed by the minimum value: `4d6min3`

For example:

```
// a normal roll
4d6: [1, 4, 3, 2] = 10
// the same roll but values less than 3 are treated as 3
4d6min3: [3^, 4, 3, 3^] = 13
```

Statistic probability

It's worth noting that it is statistically more likely to roll the minimum value than any others.

e.g. `d6min3`

4, 5, and 6 only have a *1 in 6 (16.66%)* chance of being rolled, but 3 has a *3 in 6 (50%)* chance.

`max{n}`

)

Max (**Order:** 2

The max modifier causes any dice rolls above the maximum value to be treated as the maximum value. It's the opposite of the Min modifier

To specify a maximum value, use the word `max`

followed by the maximum value: `4d6max3`

For example:

```
// a normal roll
4d6: [5, 4, 3, 2] = 14
// the same roll but values greater than 3 are treated as 3
4d6max3: [3v, 3v, 3, 2] = 11
```

Statistic probability

It's worth noting that it is statistically more likely to roll the maximum value than any others.

e.g. `d6max3`

1 and 2 only have a *1 in 6 (16.66%)* chance of being rolled, but 3 has a *4 in 6 (66.66%)* chance.

`!`

/ `!{cp}`

)

Exploding (**Order:** 3

The exploding dice mechanic allows one or more dice to be re-rolled (Usually when it rolls the highest possible number on the die), with each successive roll being added to the total.

To explode a die, add an exclamation mark after the die notation: `4d10!`

Each exploded die shows as a separate roll in the list, like so:

```
2d6!: [4, 6!, 6!, 2] = 18
```

The second die rolled the highest value, and so it exploded - we roll again. The re-rolled die also exploded, so we roll a fourth time. The fourth roll, however, did not explode, so we stop rolling.

If you want to change the number that a die will explode on, you can use a Compare Point:

```
2d6!=5 // explode on any rolls equal to 5
2d6!>4 // explode on any rolls greater than 4
4d10!<=3 // explode on any roll less than or equal to 3
```

Read more about Compare Points below.

`!=` (Not equal) compare point with exploding dice

If you want a die that only explodes on a specific value, the `!=`

(Not equal) operator will **not** work here, and you must use the alternative "not equal to" operator instead, `<>`

:

```
// Wrong! Creates a compound roll if you roll a 4.
2d6!!=4
// Correct!
2d6!<>4
```

Iteration limit

To stop infinite loops, when running something like `d10!>0`

, modifiers are limited to 1000 iterations per dice roll:

`1d10!>0`

would return 1001 rolls; the initial roll, and 1000 exploded rolls.`2d10!>0`

would return 2002 rolls; the initial 2 rolls, and 100 exploded rolls per initial roll.

This also applies to Compounding, Penetrating, and Re-roll modifiers.

`!!`

/ `!!{cp}`

)

Compounding (Sometimes, you may want the exploded dice rolls to be combined together into a single roll. In this situation, you can compound the dice by using two exclamation marks: `4d10!!`

For example:

```
// exploding re-rolls the dice
2d6!: [4, 6!, 6!, 2] = 18
// compounding combines the re-rolled dice
2d6!!: [4, 14!!] = 18
```

You can also use Compare Points to change when a die will compound:

```
2d6!!=5 // compound on any rolls equal to 5
2d6!!>4 // compound on any rolls greater than 4
4d10!!<=3 // compound on any roll less than or equal to 3
```

`!p`

/ `!!p`

/ `!p{cp}`

/ `!!p{cp}`

)

Penetrating (Some exploding dice system use a penetrating rule.

Taken from the Hackmaster Basic rules:

Should you roll the maximum value on this particular die, you may re-roll and add the result of the extra die, less one point, to the total (penetration can actually result in simply the maximum die value if a 1 is subsequently rolled, since any fool knows that 1-1=0). This process continues indefinitely as long as the die in question continues to come up maximum (but there’s always only a –1 subtracted from the extra die, even if it’s, say, the third die of penetration)

So, if I rolled `1d6`

(penetrating), and got a 6, I would roll another `d6`

, subtracting 1 from the result. If that die rolled a 6 (before the -1) it would also penetrate, and so on.

The syntax for penetrating is very similar to exploding, but with a lowercase 'p' appended: `2d6!p`

.

For example:

```
// Actual rolls are [6, 6, 6, 4, 1]
2d6!p: [6!p, 5!p, 5!p, 3, 1] = 20
```

The first roll exploded (Rolled the highest number on the die), so we rolled again and subtracted 1 from the re-roll. The second and third rolls also exploded and were re-rolled, so we subtract 1 from each.

Remember that we subtract 1 from penetrated rolls, which is why we see `5`

, `5`

, `3`

instead of `6`

, `6`

, `4`

.

You can also compound penetrating dice, like so: `2d6!!p`

You can also use Compare Points to change when a dice will penetrate:

```
2d6!p=5 // penetrate on any rolls equal to 5
2d6!!p>4 // penetrate and compound on any rolls greater than 4
4d10!p<=3 // penetrate on any roll less than or equal to 3
```

`r`

/ `ro`

/ `r{cp}`

/ `ro{cp}`

)

Re-roll (**Order:** 4

This will re-roll a die that rolls the lowest possible number on a die (Usually a 1). It will keep re-rolling until a number greater than the minimum is rolled, disregarding any of the previous rolls.

This is similar to Exploding, but explode will keep the previous rolls and add them together.

To re-roll, add an `r`

after the dice notation:

```
// roll 1 d6 and re-roll if the result is 1 (and again each time a 1 is rolled)
d6r
```

If you only want to re-roll once, even if the second roll also rolls the minimum value, you can use the `ro`

notation:

```
// roll 1 d6 and re-roll if the result is 1. Don't re-roll again, even if the second roll is also a 1
d6ro
```

If you want to change the number that a dice will re-roll on, you can use a Compare Point:

```
2d6r=5 // re-roll on any rolls equal to 5
2d6ro>4 // re-roll once on any roll greater than 4
4d10r<=3 // re-roll on any roll less than or equal to 3
```

Read more about Compare Points below.

Iteration limit

To stop infinite loops, when running something like `d10r>0`

, modifiers are limited to 1000 iterations per dice roll:

`1d10r>0`

would only re-roll 1000 times.`2d10r>0`

would re-roll 2000; once for each initial roll.

This also applies to Exploding, Compounding, and Penetrating modifiers.

`k{n}`

/ `kh{n}`

/ `kl{n}`

)

Keep (**Order:** 5

The keep modifier allows you to roll a collection of dice but to disregard all except for the highest or lowest result(s). It is the opposite of the Drop modifier.

The notation of the keep modifier is a lowercase `k`

, followed by the end that should be dropped ("h" = "highest", "l" = "lowest"), and the number of dice to drop.

The "end" is optional and, if omitted, will default to *highest*.

For example:

```
4d10kh2 // roll a d10 4 times and keep the highest 2 rolls
4d10k2 // equivalent to the above
4d10kl1 // roll a d10 4 times and keep the lowest roll
```

When outputting the roll, the kept rolls aren't modified, but the dropped rolls are given the "d" flag:

```
6d8k3: [3d, 6, 7, 2d, 5, 4d] = 9
```

Using Drop and Keep modifiers together

The keep and drop modifiers work really well together, but there are some caveats. They both look at the entire dice pool. So if a roll has been dropped, it will be still be included in the list of possible rolls to drop.

This means that using keep and drop modifiers together can override each other.

For example, the following will drop all the rolls:

```
3d10k1dh1: [7d, 1d, 2d] = 0
```

The is because the `k1`

will drop the `1`

and `2`

, and the `dh1`

will drop the `7`

.

This (perhaps more expectedly) will only keep the highest dice:

```
3d10k1d1: [6d, 1d, 9] = 9
```

The `k1`

will drop the `6`

and `1`

, and the `d1`

will also drop the `6`

.

`d{n}`

/ `dh{n}`

/ `dl{n}`

)

Drop (**Order:** 6

Sometimes you may want to roll a certain number of dice, but "drop" or remove high or low rolls from the results. It is the opposite of the Keep modifier.

The notation of the drop modifier is a lowercase `d`

, followed by the end that should be dropped ("h" = "highest", "l" = "lowest"), and the number of dice to drop.

The "end" is optional and, if omitted, will default to *lowest*.

For example:

```
4d10dl2 // roll a d10 4 times and drop the lowest 2 rolls
4d10d2 // equivalent to the above
4d10dh1 // roll a d10 4 times and drop the highest roll
```

When outputting the roll, the dropped rolls are given the "d" flag:

```
6d8dh3: [3, 6d, 7d, 2, 5d, 4] = 9
```

You can also use "drop lowest" and "drop highest" modifiers together:

```
// roll a d10 4 times and drop the highest and lowest rolls
4d10dh1dl2: [5, 3d, 7, 8d] = 12
```

Using Drop and Keep modifiers together

See the note in the Keep modifier section regarding using the two together

`{cp}`

)

Target success / Dice pool (**Order:** 7

Some systems use dice pool, or success counts, whereby the total is equal to the quantity of dice rolled that meet a fixed condition, rather than the total value of the rolls.

This can be achieved by adding a Compare Point notation directly after the die notation.

For example, a "pool" of 10 sided dice where you count the number of dice that roll an 8 or higher as "successes":

```
5d10>=8
```

You can use any valid Compare Point notation.

Examples:

```
2d6=6: [4, 6*] = 1 // only a roll of 6 is a success
4d3>1: [1, 3*, 2*, 1] = 2 // greater than a 1 is a success
4d3<2: [1*, 3, 2, 1*] = 2 // less than a 2 is a success
5d8>=5: [2, 4, 6*, 3, 8*] = 2 // greater than or equal to 5 is a success
6d10<=4: [7, 2*, 10, 3*, 3*, 4*] = 4 // less than or equal to 4 is a success
```

Not equal to

You cannot count success for any number that is *not* equal to a certain value, like:

```
2d6!=3
```

Because it will conflict with the Explode modifier, and it will instead explode on any roll of `3`

Modifiers with compare points

Another caveat is that the target modifier cannot directly follow any modifier that uses Compare Points, otherwise the Target modifier will be instead be used as the Compare Points for the modifier:

```
2d6!>3 // explode on any roll greater than 3
```

But you can work around this by specifying the Target compare point first:

```
2d6>3! // explode on a roll of 6, greater than 3 is a success
2d6>3!<4 // explode on any roll greater than 4, greater than 3 is a success
```

`f{cp}`

)

Target Failures / Dice Pool (**Order:** 7

Sometimes, when counting success, you also need to consider failures.

A failure modifier *must* directly follow a Success modifier, and works in much the same way.

For each failure counted, it will *subtract 1* from the total number of successes counted.

The Failure modifier is a Compare Point, preceded with the lowercase letter "f":

```
// greater than 4 is success, less than 3 is failure
4d6>4f<3: [2_, 5*, 4, 5*] = 1
```

`cs{cp}`

)

Critical Success (**Order:** 8

TIP

This is purely aesthetic and makes no functional difference to the rolls or their values.

When a die rolls the highest possible value, such as rolling a 20 on a d20, this is called a critical success.

However, sometimes you want a critical success to be on a different value, or a range, such as 18-20 on a d20.

To specify what is considered as a critical success, add `cs`

and a Compare Point, after the die notation:

```
// roll a d10 4 times, anything greater than 7 is a critical success
4d10cs>7
```

The roll result output will look something like this:

```
// the rolls of 20 and 18 are critical successes
5d20cs>=16: [3, 20**, 18**, 15, 6] = 62
```

`cf{cp}`

)

Critical Failure (**Order:** 9

TIP

This is purely aesthetic and makes no functional difference to the rolls or their values.

When a die rolls the lowest possible value, such as rolling a 1 on a d20, this is called a critical failure.

However, sometimes you want a critical failure to be on a different value, or a range, such as 1-3 on a d20.

To specify what is considered as a critical failure, add `cf`

and a Compare Point, after the die notation:

```
// roll a d10 4 times, anything less than 3 is a critical failure
4d10cf<3
```

The roll result output will look something like this:

```
// the rolls of 3 and 6 are critical failures
5d20cf<=6: [3__, 20, 18, 15, 6__] = 62
```

`s`

/ `sa`

/ `sd`

)

Sorting (**Order:** 10

You can sort the dice rolls, so that they are displayed in numerical order by appending the `s`

flag after the dice notation.

The default order is ascending, but you can specify the sort order using `sa`

and `sd`

for ascending and descending respectively:

```
4d6: [4, 3, 5, 1] // no sorting
4d6s: [1, 3, 4, 5] // default sort the results ascending
4d6sa: [1, 3, 4, 5] // sort the results ascending
4d6sd: [5, 4, 3, 1] // sort the results descending
```

## Compare point

Many modifiers perform an action when the die rolls either the highest or lowest possible number. Sometimes you may want the modifier to execute on different values, and this is what Compare Points are for.

A compare point is a comparative operator, followed by the number to match against (e.g. `=8`

)

The following are valid comparative operators:

```
= // equal to
!= // not equal to
<> // Also not equal to
< // less than
> // greater than
<= // less than or equal to
>= // greater than or equal to
```

Wherever you can use compare points, the notation is the same. So if you wanted to check if a number is *"greater than or equal to 5"*, the notation would look like:

```
>=5
```

Here are some examples with full notation strings:

```
d6!=3 // roll a d6 and explode any roll equal to 3
d10!>=5 // roll a d10 and explode on any roll greater than or equal to 5
d6!!>4 // roll a d6 and compound only on rolls greater than 4
d6!<>4 // roll a d6 and explode on any roll not equal to 4
d4r<3 // roll a d4 and re-roll anything less than 3
```

`!=`

| `<>`

)

Not equal to (There are two different operators for "not equal to"; `!=`

and `<>`

.

These operators both function exactly the same, and are interchangeable. Typically, throughout the documentation, you'll see the former used for consistency.

The second form `<>`

was introduced as a way of being able to use "not equal" checks in combination with exploding dice.

Example

If we wanted to explode any dice that do **not** roll a `4`

.

This will not work, and will instead create a compound roll if you roll a `4`

:

```
2d6!!=4
```

This will correctly explode if the value is *not* `4`

:

```
2d6!<>4
```