Runtime formulas
A runtime formula is a formula with parameters. It doesn't show a stored value on a record. It becomes a method in the generated C# that your game calls whenever it needs the answer. Use one when the result depends on the moment, like damage after armour, where the armour is only known during play.
Make a formula a runtime formula
Add at least one parameter. A formula with parameters is a runtime formula, and the list on the object type marks it with a Runtime badge. You can't use it as a formula field.
What your code gets
A runtime formula is generated as a static method that takes the record and then the parameters, in the order you set. A formula named damage_taken with an armour parameter on a Weapon type becomes a method you call with a weapon and an armour value. The parameter types you chose become the C# types.
Generated code shows where the files go.
Evaluate it in the editor
Use Test values to try the formula with sample parameters against any record. This is how you check the numbers before your game does.
Keeping your code working
Because your game calls the method by name, changing it can stop your code compiling. These are treated as breaking:
- Renaming the formula.
- Adding, removing, renaming or reordering parameters, or changing their type.
- Removing all the parameters, which turns the method into a plain formula and removes it.
Stoatly shows a warning banner and asks you to review the list before you save. Making a plain formula into a runtime formula by adding parameters isn't breaking, because there was no method to break.