09-07-2013, 06:09 PM
If you had read the RPGm XP help manual you would have known that rand(n) function can do exactly what you want. Well almost.
And VVulfy, that is a little too much computational overhead for my tastes (and I've never seen a die numbered 0 to sides-1). I'd do it like this:
Then rolls are just:
And VVulfy, that is a little too much computational overhead for my tastes (and I've never seen a die numbered 0 to sides-1). I'd do it like this:
Code:
module Roll
#--------------------------------------------------------------------------
# d - simulates a dice roll (num: 1 to sides)
# *sides : how many sides the dice has
#---------------------------------------------------------------------------
def d(sides)
return rand(sides)+1
end
end
Then rolls are just:
Code:
strength_roll = Roll.d(20)