# Formulas

RPG Architect leverages a formula engine, allowing users to create their own formulas when leveraging Statistics in Skills and more.

• Whenever a Success Formula is defined anywhere, it is always calculating it out of 100. Specifying a raw value of "100" will ensure that it is always successful.
• Anytime a Success Formula is evaluated, the engine is randomly generating a whole number between 0 and 99. If it is below the value calculated for the Success Formula it will be "successful."

NameReference
ee
pipi

# Functions

NameDescriptionExampleExample Result
absAbsolute valueabs(-5)5
acosArccosineacos(pi)
acotArccotangentacot(pi)
asinArcsineasin(pi)
atanArctangentatan(pi)
avgAverageavg(1,7,12,15,8)8.6
ceilingCeilingceiling(1.2)2
cosCosinecos(pi)-1
diceRolls x amount of dice with n sides.
dice(x,n)
dice(4,6)Rolls 4 6-sided dice (Result between 4 and 24)
dicepoolRolls x amount of dice with n sides, targeting a minimum value of t per roll.
dicepool(x,n,t)
dicepool(4,10,7)Rolls 4 10-sided dice, attempting to roll 7 or higher.
floorFloorfloor(1.2)1
globalfloatGets a global variable as a floating-point.globalfloat(0)Gets the global variable at index 0, as a floating point.
globalintGets a global variable as an integer.globalint(4)Gets the global variable at index 4, as an integer.
ifProvides a value if a condition is true or false.
if(condition, true_value, false_value)
if(lvl > 10, 15, 20)Gets 15 if the 'lvl' variable is greater than 10, otherwise 20.
lastfloatThe last number generated by the formula parser, represented as a floating-point.lastfloat()
lastintThe last number generated by the formula parser represented as an integer.lastint()
logeNatural Logarithmloge(2)
log10Logarithmlog(10)1
lognLogarithm (Base)logn(5, 4)
maxGets the maximum value in a series of numbers.max(4,8,12,-1,400,2)400
medianGets the median value in a series of numbers.med(4,8,6)6
minGets the minimum value in a series of numbers.min(4,8,12,-1,400,2)-1
randomGenerates a random number between 0.0 and 1.0.random()0.12455.
sinSinesin(pi)0
sqrthttps://www.wikipedia.org/wiki/Square rootsqrt(4)2
Note: RPG Architect utilizes sonic for its calculation engine, due to its speed and flexibility. You can refer to its wiki for answers to common questions.