Dice roll mechanics?


#1

So, how do I implement dice mechanics? Not the totally random ones, but with modifiers and possibly multiple die at the same time (2d6 and such).


#2

Before someone posts a complete example and you potentially copy and paste, without understanding exactly how/why it works. Have a think, how would you implement it?

There’s a *rand command, with min and max values… Which could be 1 and a variable dice_size… Now you need a way to do this multiple times (loops with goto/labels?). Have a think, and feel free to discuss it here, and post your code if you have an issue, but do try to start this yourself. You (and your games) will benefit in the long run.


#3

I think @MichaelMaxwell could help you, maybe. There is a dice mechanic is his upcoming game.


#4

@CJW is completely right. You can do it however you wish.

Though in my game it’s a very complex system of variables, penalties, and dice rolls, with DCs(Difficulty Classes) being the determinant factor of whether or not they pass the roll.

Though that’s very complex, and trust me… it was a pain in my behind for days to code in without anything to go from. I had to work completely from scratch. But it works, and it’s pretty awesome in my opinion…

But like @CJW said, it’s your game, and do so as simple, or as complex as you see fit :smile:

Here’s my complex and double-edged script if you want an example… it’s based off of Dungeons and Dragons… but I tailored it to fit my game
:arrow_down:
https://pastebin.com/nyBcFcjA

Hope this helps :wink:

P.S: Thank you @ArchangelVoldemort for mentioning me :smile:

P.P.S: I just realized how incredibly confusing it was… so I made a simpler version of it :laughing: Sorry…

https://pastebin.com/V1Bymhmb


#5

I suppose with a few adjustments (removing luck, adding disadvantage and advantage) this is just what I’ve been looking for. Though I’m still far from making an actual WIP. Thank you.


#6

You are very much welcome. Hope your work goes well! :smile: