Formulas
Formulas are expressions that calculate a number dynamically, often based on a character’s attributes or other values.
Instead of using a fixed number, formulas can reference fields like {Strength} or {Level} to produce results that update automatically when those values change. Eg:
{Level} * 10 // 10 times Level
({Strength} - 10)/2 // D&D 5e STR modifier
max({STR}, {DEX}, 1) // max between STR, DEX, or 1
{Level} = 1 ? 8 : 5 // If Level is 1, return 8; otherwise, return 5
lookup({Level}: 0, 2,2,2,2,3,3,3,4,4,5) // Pick the value from the list at index {Level}
Formulas are used to automate calculations throughout the game, keeping numbers accurate and reducing manual work.
They can be used to automatically compute Attributes, evaluate Effect Arguments, or item stats like Weapon Damage.
Features:
1) References
Use { } to reference a character Attribute, such as
{Strength}.
This is evaluated during play at the active Character's total Strength value.
2) Numeric Operators: + - * /
{Strength} + 10
3) Functions:
- min, max: returns the minimum/maximum of a series of values
min({Strength}, {Level} + 2, 1) - count: counts the number of non-zero values:
count({STR}, {DEX}, {CON}) - sign: returns -1, 0 or 1, depending of the number is negative, zero, or positive
sign({STR}) - lookup: return the value at a given index from an array (starting with 0)
lookup({Level}:0,1,5,10,20,50)
- For Level = 0 will return 0
- For level = 1 will return 1
- For level = 2 will return 5
...
- For level > 5, will return 50
4) Conditional Operator: ?
Condition ? ResultIfTrue : ResultIfFalse
Evaluate a simple condition, and return a different result based on whether the condition is true or false.
{Level} = 1 ? 8 : 5– if Level = 1, return 8, otherwise return 5
5) Dice Operators:
You can reference dice and or Dice Attributes in your formulas.
Be aware that dice values, such asd8will be evaluated on the spot, so you will get a random value between 1 and 8 when using d8 in your formula.
Instead, you can use Dice operators for Dice Attributes to extract deterministic values from Dice Attributes.
min({Hit Dice})orcount({Hit Dice})- minimum amount your Hit Dice can roll or the number of dice in that dice pool (since a die can roll a minimum of 1)
max({Hit Dice})- maximum amount your Hit Dice can roll (a 4d8 will return 32)
avg({Hit Dice})- the average amount for this Hit Dice, rounded up
roll({Hit Dice)}- a random value rolled by your attribute
Info
Use Paranthesis ( ) to enforce order of operations when uncertain
Info
Avoid Dividing to a reference! Users may override values to zero and division by zero will cause issues.