Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Dice module by Balrogic
- #
- # This is a fairly simple bit of code that adds full
- # d20 dice functionality to an RPG Maker project.
- #
- # How to use: Script calls
- # You may include the expression Dice::d6(4) in your
- # script call to roll 4d6 dice, as an example of how
- # this works. If you want to add that to a variable,
- # call the following.
- #
- # $game_variables[1] = Dice::d4(7)
- #
- # Ouch! That's a lot of magic missiles. To use in
- # skills and battle formulas uncomment the class at
- # the bottom of the script and include something like
- # a.d10(5) in the skill formula bar.
- module Dice
- def self.d2(x=1); i = x; i.downto(1) {x += rand(2) + 1}; x - i; end
- def self.d4(x=1); i = x; i.downto(1) {x += rand(4) + 1}; x - i; end
- def self.d6(x=1); i = x; i.downto(1) {x += rand(6) + 1}; x - i; end
- def self.d8(x=1); i = x; i.downto(1) {x += rand(8) + 1}; x - i; end
- def self.d10(x=1); i = x; i.downto(1) {x += rand(10) + 1}; x - i; end
- def self.d12(x=1); i = x; i.downto(1) {x += rand(12) + 1}; x - i; end
- def self.d20(x=1); i = x; i.downto(1) {x += rand(20) + 1}; x - i; end
- def d2(x=1); i = x; i.downto(1) {x += rand(2) + 1}; x - i; end
- def d4(x=1); i = x; i.downto(1) {x += rand(4) + 1}; x - i; end
- def d6(x=1); i = x; i.downto(1) {x += rand(6) + 1}; x - i; end
- def d8(x=1); i = x; i.downto(1) {x += rand(8) + 1}; x - i; end
- def d10(x=1); i = x; i.downto(1) {x += rand(10) + 1}; x - i; end
- def d12(x=1); i = x; i.downto(1) {x += rand(12) + 1}; x - i; end
- def d20(x=1); i = x; i.downto(1) {x += rand(20) + 1}; x - i; end
- end
- #class Game_BattlerBase
- # include Dice
- #end
Advertisement
Add Comment
Please, Sign In to add comment