d6(int)

From NWN Lexicon
Revision as of 00:09, 25 June 2022 by Jasperre (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Rolls a 6-sided die.

int d6(
    int nNumDice = 1
);

Parameters

nNumDice
The number of dice to roll. (Default: 1, maximum 255)


Description

Returns the total from rolling nNumDice x d6 dice.

If nNumDice is less than 1, then 1 is used. If nNUmDice is over 255 it overflows, making 256 be "0" dice rolled, 257 be 1 die, and so on.


Remarks

An easier way to have dice rolls visible in code, which in D&D comes up a lot.

A d6 (six sided die) has a 16.6% probability of turning up numbers between 1 and 6.

A single roll is equivalent of running:

Random(6) + 1;

Version

1.22


See Also

functions:

Random d2 d3 d4 d8 d10 d12 d20 d100



author: Charles Feduke