Stats overview popularité : 88
Statistics popularité : 89
Attributes popularité : 91
Status Effects popularité : 91
Formulas popularité : 92
Stat Modifiers popularité : 88
Stats UI popularité : 68
Slide 1
Slide 2
Slide 3
Slide 4
Slide 5
Slide 6
Slide 7
Slide 8
Slide 9
Slide 10
IMAGE OR CARROUSEL for section header You successfully read this important alert message.

TEXTE AVANT FILTRAGE

Introduction

Every RPG game has its own system. Some are based on the famous D20 from Dungeons and Dragons and other have their own proprietary system. In order to give you the flexibility to use whatever system you want we’ve come up with the Formula objects, which all they do is output a number.

Formulas can be used for a wide variety of things. For example:

- Define the value of a Stat
- Calculate the damage output of an attack
- Display new Dialogue options based on the output of a Formula

Basics

Let’s begin with the basics. A Formula object has a text field where you can type some words. Let’s begin with something very simple:

When we execute this formula, the output will always be 5. If we use this as the Formula for the strength stat, the player and all the enemies will always have a strength of 5 points.

This Formula always returns a fixed value; Not very exciting, huh? Let’s complicate things a bit.

Let’s say we’re creating a Formula that will define the value of our dexterity stat. In our game, the dexterity helps the player shoot with more accuracy. The base value (initial value) is 1 and is increased by 5 for each level. The Formula of the dexterity would then be:

Let’s break this down. Formulas have a set of pre-defined symbols that help you build your own mathematical expressions. One of them is the this[value] symbol, which basically means the base value of the Stat, in this case: 1

Another Formula symbol is the stat[NAME]. This allows you to access the final value of a stat identified by NAME from the same object. In this case, we’re accessing the level of the character and we multiply this value by 5.

The result of the previous formula is that if the player is at level 1, its dexterity stat will be 1 + (1 * 5) = 6, and if its at level 4 it will be 1 + (4 * 5) = 21.

Still reading? Great! You have just learned the hardest part!

Intermediate

Now that you know the basics of how a Formula works, let’s dig a bit deeper. We previously saw how to calculate a character’s stat using its own information. But we might also want to calculate a value taking into account two objects.

The most common scenario would be having a character attack an enemy. The damage of the attack could be the value of the strength stat of the player minus the armor stat of the enemy.

assets%2F-LAqwYovmUPn5V6CMeID%2F-LM6d16XIV9Y18TOGE2i%2F-LM6dQlbrHzc-GqyR0dq% (...)

(Example of an Action using a Target and an Opponent field for the Formula)

In this case, the Formula would be:

The stat[NAME] symbol refers to the invoker of the calculation. In this case, the player wants to know the amount of damage it outputs. The stat:other[NAME] refers to the opponent of the Formula.

>