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 Amounts, 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, or of an Attribute Group:
min(Strength, Level + 2, 1)
max(STR, DEX, CON)
max({Strength Modifier}, {Dexterity Modifier}, 0)
min({Ability Scores})
max(Skills)
avg
returns the average of a series of values, or of an Attribute Group:
avg(STR, DEX, CON)
avg({Ability Scores})
ceil, floor
round a value up or down to the nearest whole number:
ceil(Level / 2)
floor({Strength Score} / 2)
count
counts how many of the given values, or of the attributes in an Attribute Group, are non-zero:
count(STR, DEX, CON)
count(Skills)
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.
You can skip ahead by writing
index: value. The value then applies from that index upward, until the next one takes over:
lookup(Level: 0, 5: 4, 10: 6, 20: 8)
Level Result 0–4 0 5–9 4 10–19 6 20+ 8
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
min, max, avg, roll and count can also read a number out of a Dice Pool, like max({Hit Dice}) for the highest the pool can roll. See Dice Operators.
Tip
For further assistance with writing the correct formula for your games, contact us and we'll help you out!