Dicebag

An asset by Cablefish
The page banner background of a mountain and forest
Dicebag hero image

Quick Information

0 ratings
Dicebag icon image
Cablefish
Dicebag

A Godot 4 port of Dicebag by 8bitskull, originally in Lua for Defold.It contains various random dice and RNG functions that are useful for anyone making RPG's and especially those that emulate tabletop RPGs.Converted to Godot 3.2 by yagichConverted again to Godot 4.0 by cablefish1 who removed some functions and rewrote some.Join the RPGodot discord to join the development of more universal RPG tools.

Supported Engine Version
4.0
Version String
1.0
License Version
CC0
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL

dicebag

A Godot 4 port of Dicebag by 8bitskull, originally in Lua for Defold.

It contains various random dice and RNG functions that are useful for anyone making RPG's and especially those that emulate tabletop RPGs.

Converted to Godot 3.2 by yagich

Converted again to Godot 4.0 by cablefish1 who removed some functions and rewrote some.

Join the RPGodot discord to join the development of more universal RPG tools.

Installation

You can add Dicebag to your own projects using the built-in Asset Library. Once it is added to your project, you need to add an instance of Dicebag to the script you wish to use it in, before the _ready() function:

@onready var dicebag = Dicebag.new()

func _ready():
...

Then you can use Dicebag functions, for example:

var coin = dicebag.flip_coin()

Remember to do a randomize() before you call the scripts if you don't want your results to repeat.

Usage

dicebag.flip_coin()

Flip a coin.

RETURNS

  • result (bool) - true or false (50% chance).

dicebag.roll_dice(num_dice, num_sides, modifier)

Roll a number of dice, D&D-style. An example would be rolling 3d6+2. Returns the sum of the resulting roll.

PARAMETERS

  • num_dice (int) - Number of dice to roll.

  • num_sides (int) - Number of sides on the dice.

  • modifier (int) - Number to add to the result.

RETURNS

  • result (int) - Sum of rolled dice plus modifier.

dicebag.roll_special_dice(num_sides, advantage, num_dice)

Roll a number of dice and return the highest (advantage) or lowest (disadvantage) results.

PARAMETERS

  • num_sides (int) - Number of sides on the dice.

  • advantage (bool) - If true, the highest rolls will be selected, otherwise the lowest values will be selected.

  • num_dice (int) - Number of dice to roll.

RETURNS

  • result (int) - The highest (advantage) or lowest (disadvantage) dice roll.

dicebag.roll_table(sides)

Pick a random place in a user defined table. I.e. a loot table.

PARAMETERS

  • weighted_loot_table is an array in the format [[weight1, value1], [weight2, value2] ...]. The function adds the weights and returns a random value based on the weighted probabilities.

RETURNS

  • value (Variant) - The value as specified in Array weighted_loot_table.

A Godot 4 port of Dicebag by 8bitskull, originally in Lua for Defold.

It contains various random dice and RNG functions that are useful for anyone making RPG's and especially those that emulate tabletop RPGs.

Converted to Godot 3.2 by yagich

Converted again to Godot 4.0 by cablefish1 who removed some functions and rewrote some.

Join the RPGodot discord to join the development of more universal RPG tools.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Dicebag icon image
Cablefish
Dicebag

A Godot 4 port of Dicebag by 8bitskull, originally in Lua for Defold.It contains various random dice and RNG functions that are useful for anyone making RPG's and especially those that emulate tabletop RPGs.Converted to Godot 3.2 by yagichConverted again to Godot 4.0 by cablefish1 who removed some functions and rewrote some.Join the RPGodot discord to join the development of more universal RPG tools.

Supported Engine Version
4.0
Version String
1.0
License Version
CC0
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers