Formulas
Formulas let you automate calculations in your game.
Instead of typing a fixed number, you write an expression that references your character's attributes — and the result updates automatically whenever those attributes change.
{Level} * 10 // 10 times Level
({Strength} - 10) / 2 // D&D 5e STR modifier
max({STR}, {DEX}, 1) // the highest of STR, DEX, or 1
{Level} = 1 ? 8 : 5 // if Level is 1, return 8; otherwise 5
lookup({Level}: 0,2,2,2,2,3,3,3,4,4,5) // pick a value from a list based on Level
Formulas can be used to automatically compute Attributes, evaluate Effect Arguments, or calculate item stats like Weapon Damage.
Tip
Looking to build dice expressions like [Strength]d10? See Dice Formulas.
References
Type an attribute's name to reference its value in a formula.
For single-word names, you can type the name directly: Strength
For multi-word names, wrap it in curly braces: {Strength Modifier}
Curly braces always work, even for single-word names —
{Strength}andStrengthare equivalent.
The reference evaluates to the attribute's current total value during play.
Operators
Standard math operators: + - * /
{Strength} + 10
Info
Use parentheses ( ) to enforce order of operations when uncertain.
Warning
Avoid dividing by a reference! Players may override values to zero, and division by zero will cause issues.
Functions
-
min, max — return the smallest or largest of a series of values:
min({Strength}, {Level} + 2, 1)
max({STR}, {DEX}) -
count — counts how many of the given values are non-zero:
count({STR}, {DEX}, {CON}) -
sign — returns -1, 0, or 1 depending on whether the value is negative, zero, or positive:
sign({STR}) -
lookup — picks a value from a list using an index (starting at 0):
lookup({Level}: 0, 1, 5, 10, 20, 50)Level Result 0 0 1 1 2 5 3 10 4 20 5+ 50 If the index exceeds the list length, the last value is used.
Player Input
Sometimes you want the Player to have control over part of a formula — like toggling whether a skill is Proficient, or setting a Rank.
Use the character x to represent the Player's input:
STR + Proficiency * x
This sets a skill's value to STR, and adds Proficiency only when the Player's input is 1 (toggled on).
Withx = 0, the result is just STR. Withx = 1, it's STR + Proficiency.
The Creator controls what kind of input the Player sees (toggle, number, custom options) through the attribute's Input settings. Learn more about configuring inputs in Creator Tools > Attributes.
Referencing Another Attribute's Input
If you need to read the Player input of a different attribute, append .x after its name:
Acrobatics.x
Returns the Player's input for the Acrobatics attribute — for example, 1 if Proficiency is toggled on, 0 otherwise.
.x returns 0 if the referenced attribute does not use an input in its formula.
Conditional Operator
Evaluate a condition and return a different result depending on whether it's true or false:
Condition ? ResultIfTrue : ResultIfFalse
{Level} = 1 ? 8 : 5— if Level equals 1, return 8; otherwise return 5
{STR} > 10 ? {STR} - 10 : 0— if STR is above 10, return the difference; otherwise 0
Supported comparisons: =, >, <, >=, <=
Dice Operators
Dice Operators let you extract a numeric value from a Dice Pool.
This is useful when you need a number derived from a Dice Pool, rather than the pool itself.
min({Hit Dice})— the minimum the pool can roll (also equals the number of dice, since each die rolls at least 1)
max({Hit Dice})— the maximum the pool can roll (e.g. 4d8 returns 32)
avg({Hit Dice})— the average roll, rounded up
roll({Hit Dice})— a random value, rolled on the spot
count({Hit Dice})— the number of dice in the pool
Warning
Using a raw die like d8 in a formula will roll it immediately and return a random number. This is usually not what you want — use Dice Operators on a Dice Pool instead for predictable results.
Info
Dice Operators return a number. If you want to build or combine dice pools (e.g. making the number of dice depend on an attribute), see Dice Formulas.
Tip
For further assistance with writing the correct formula for your games, contact us and we'll help you out!