rollAddWithLower

From RPTools Wiki
Jump to navigationJump to search

rollAddWithLower() Function

Generates random numbers to emulate dice rolls. The add parameter is added to each die and all intermediate results that are then lower than the minimum parameter are replaced with that value instead. The total is returned.

Usage

rollAddWithLower(times, sides, add, minimum)

Parameters

  • times - The number of times to roll the dice.
  • sides - The number of sides the dice possess.
  • add - The number to add to each die roll.
  • minimum - The minimum value (after the addition) that each individual die will contribute to the total.

Examples

Roll five twenty-sided dice. Add 3 to each. Any value now lower than 8 is treated as 8.
[t: rollAddWithLower(5, 20, 3, 8)]
Returns a number that is between 40 and 115 (and no longer 5 to 100 as with a regular 5d20 roll).

See Also

The corresponding dice roll expression is XdYaZlW. For other methods of rolling dice, see Dice Expressions.