# herostun

From RPTools Wiki

Jump to navigationJump to search## herostun() Function

Generates random numbers to emulate dice rolls; acts like a standard roll() with the difference being that a hidden variable is tracked, which can then be returned using herobody(). This hidden variable is calculated by adding

`2`

for each dice that is rolled at maximum value, `0`

for each dice that is rolled at minimum value, and `1`

for each dice that is rolled at neither minimum, nor maximum value.### Usage

`herostun(times, sides)`

`hero(times, sides)`

**Parameters**

`times`

- The number of times to roll the dice.`sides`

- The number of sides the dice possess.

### Examples

Roll a twenty-sided dice, and return the herobody() result as well.
Returns a number than is between

`[t: herostun(1, 20)] - [t: herobody(1, 20)`

Returns a number that is between `1`

and `20`

for the herostun roll, and a number between `0`

and `2`

for the herobody roll.

Roll five ten-sided dice, and return the herobody() result as well, using variables.

```
[h: DiceTimes = 5]
[h: DiceSides = 10]
[t: herostun(DiceTimes, DiceSides)] - [t: herobody(DiceTimes, DiceSides)]
```

`5`

and `50`

for the herostun roll, and a number between `0`

and `10`

for the herobody roll.