ID:164725
 
Ok. I have been looking around abit but I have not found anything to help me with my problem.

I am trying to design a game useing a D&D basis of rolling.

For example, a bastard sword does 1d10 (a random number between 1 and 10 in other words)

Basically, what i want to know is, is there a way to set up a Var for each dye. namely like d4 d6 d8 d10 d20 etc, so I can easily make weapons and everything that should be random, random by just having it call upon said varible, without the varible being set at one number.
Krythos wrote:
Ok. I have been looking around abit but I have not found anything to help me with my problem.

I am trying to design a game useing a D&D basis of rolling.

For example, a bastard sword does 1d10 (a random number between 1 and 10 in other words)

Basically, what i want to know is, is there a way to set up a Var for each dye. namely like d4 d6 d8 d10 d20 etc, so I can easily make weapons and everything that should be random, random by just having it call upon said varible, without the varible being set at one number.

Well, to make a random number from 1 through 10 just put rand(1,10)

Dice rolling is already in BYOND so all you need to do is use the roll variable, like quoted below from the DM guide.
obj/potion/healing
var/dice = "3d6"
verb/drink()
var/h = roll(dice)
if(h>15) usr << "Very refreshing!"
else usr << "You feel better."
Krythos wrote:
Ok. I have been looking around abit but I have not found anything to help me with my problem.

I am trying to design a game useing a D&D basis of rolling.

For example, a bastard sword does 1d10 (a random number between 1 and 10 in other words)

Basically, what i want to know is, is there a way to set up a Var for each dye. namely like d4 d6 d8 d10 d20 etc, so I can easily make weapons and everything that should be random, random by just having it call upon said varible, without the varible being set at one number.

Yup! The roll() proc takes either a number (for one die with that many sides) or a string like "1d10+2". (If you want -, currently you have to put a + in front of it; i.e. you'd use roll("4d3+-8") to simulate 4 Fudge dice. I've fixed this for BYOND 4.0 however.) If you set the sword's damage var to "1d10", then you only need roll(damage) to calculate its damage.

I've done a recent post over at Dungeon Crawlers that should prove helpful to your purposes as well. It includes a proc that will use a number directly without rolling if you've set one, or will use a roll formula.

Lummox JR