Create custom rolls

In GPHUD there are various commands that are used to roll dice, such as

  • Roller.Roll
  • Roller.RollAgainst
  • Health.HealRoll (covered in health module)
  • Roller.RollDamageAgainst (covered in more depth in health module)

These commands can be directly placed on menus or quick buttons (see how to Configure the user experience), however this will expose all the functionality to the player, which includes entering dice count, sides on dice, and so forth.

Like many commands in GPHUD this command is intended to be “Aliased”. An alias is a command you create that is based on an existing command, but with some of the fields filled in automatically.

Aliases are created under Configuration → Aliases, and a couple of these are supplied with every new installation of GPHUD. When you first create an alias you will be asked for the name - this is the name of the alias and should be meaningful to you, and the command it “templates”, that is, what command it should pass through to. This may just be roller.roll for standard dice rolls, or any of the other commands if you want to achieve a “versus” roll, damage, or healing effects.

We will analyse both of the pre-supplied roll aliases as they provide some basic insight into the system:

Fixed 'damage' roll

This is the most basic and complete kind of command, it invokes roller.roll, so it only does a dice roll (does not inflict any health damage); All of the values have been filled in, and when this command (“Alias.Damage”) is run, a 1d6 roll will be done with a reason of “Damage roll”. In the default GPHUD this is mapped to the sword icon on the left side of the HUD (but this can be changed under Configure the user experience).

Note that the bias is explicitly stated as zero - if this field was left blank instead the end user would be asked to fill in the value. By having zero we ensure this is always a “flat” 1d6 roll.

Roll with bias and reason

The next command represents the original HUD roll, it allows the user to enter a reason and otherwise rolls 1d100 + their level:

Note that the reason field is left blank - any blank fields are filled in by the end user, so this command will prompt the user for the reason, but otherwise will roll 1d100 + –LEVEL–. The –LEVEL– is called a template and is substituted with the player's LEVEL, meaning their dice roll goes up as they level up.

Roll against using target's attributes

There is no pre-supplied example for this, as this would require you to have certain character attributes set up in advance. In my simplistic test environment I created two attributes called Attack and Defence, which are supposed to boost the respective parties roll.

In this example both the “reason” and “target” field are left blank, this allows the end user to specify why they're rolling, and pick who they're rolling against. Both sides roll 1d10 (dicedsides vs targetdicedtargetsides) but each side also gains a bias, for the attacker this is –ATTACK– which is an automatic template of their attack attribute (see Templates).

While there is also a –DEFENCE– template, this would end up being the /attackers/ (instigators) defence score, –TARGET:attribute– may be used to pick the target's score. Note that only commands with an explicit 'target' field support this.

Heal self roll

As a final example, this is an alias wrapped around the healing command that causes you to target yourself, making it a quick one-click action.

This is mainly included here as an example of specifying a fixed target, the [[Templates|template] –NAME– resolves to the current character's name, thus creates a self heal from the targetable heal.