explodingSuccess: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Fixed the description of the return value to state that it is a formatted string rather than a single number)
(Add reference to openTest)
 
(One intermediate revision by the same user not shown)
Line 30: Line 30:


|also=
|also=
For another method of rolling dice, see [[Dice Expressions]].
For another method of rolling dice, see [[Dice Expressions]].<br>
 
For a similar function that returns the highest roll instead of the number of successes, see [[openTest]].
}}
}}
[[Category:Dice Function]]
[[Category:Dice Function]]

Latest revision as of 23:59, 1 August 2023

explodingSuccess() Function

Generates random numbers to emulate dice rolls; any dice that are rolled at maximum value are rolled again with the new roll added to the old. Returns a formatted string containing the result of each roll and the number of rolls that were at least the target number.

Usage

explodingSuccess(times, sides, target)

Parameters

  • times - The number of times to roll the dice.
  • sides - The number of sides the dice possess.
  • target - The number that a dice needs to be equal to or higher to be considered a success (added to the count returned).

Examples

Roll a twenty-sided dice, and return one success if rolled higher than 30.
[t: explodingSuccess(1, 20, 30)]

Returns a string similar to Dice: 35, Successes: 1 or Dice: 8, Successes: 0. The success count will either be 0 or 1, with 1 only returned if the twenty-sided die rolls 20 and then is rerolled(exploded) with a result equal to or higher than 10.

Roll five ten-sided dice, and returns the number of dice that rolled higher than twenty, using variables.

[h: DiceTimes = 5]
[h: DiceSides = 10]
[h: DiceTarget = 20]
[t: explodingSuccess(DiceTimes, DiceSides, DiceTarget)]
Returns a string similar to Dice: 25, 14, 35, 2, 15, Successes: 4, where the successes will be between 0 and 5.

See Also

For another method of rolling dice, see Dice Expressions.
For a similar function that returns the highest roll instead of the number of successes, see openTest.