In this article we will see how to create simple mathematical expressions in Blueprints using arithmetic operators.

The arithmetic operators are grouped by data type within the category "Call Function -> Math" of the list of actions that appear when you right-click on EventGraph.

The image below shows some arithmetic operators of type Integer.

The arithmetic operators are grouped by data type within the category "Call Function -> Math" of the list of actions that appear when you right-click on EventGraph.

The image below shows some arithmetic operators of type Integer.

These operators receive two input values on the left and gives the operation result on the right. The operators "+" and "x" allow more than two input values. To use it just click on the "Add Pin" option. The input values can be entered directly or can be obtained from variables.

Let's start with a very simple expression that adds 10 points to the current player's score. Lets assume that there is an Integer variable called "Score" containing the current score. The image below shows the expression associated with the Event "Actor Begin Overlap".

Let's start with a very simple expression that adds 10 points to the current player's score. Lets assume that there is an Integer variable called "Score" containing the current score. The image below shows the expression associated with the Event "Actor Begin Overlap".

The above expression is assigning a new value for the variable "Score". To add this type of Action simply drag the variable to the EventGraph and choose the "Set" option. This new value is the sum of the value 10 and the current value of the "Score" variable which is obtained by using the "Get" option.

Now let's create an expression that is used to calculate the "Attack Power" of a character in the game

Attack Power = (Level x 3) + (Strength x 2 - 20)

To this expression we need to create three integer variables:

Now let's create an expression that is used to calculate the "Attack Power" of a character in the game

*World of Warcraft*. The expression uses the values of "Level" and "Strength" of the character. The expression is as follows:Attack Power = (Level x 3) + (Strength x 2 - 20)

To this expression we need to create three integer variables:

The icon that contains an open eye on the side of variables "Level" and "Strength" indicates that they can be modified direct in the level editor. The variable "Attack Power" should not be editable because its value is obtained from the expression.

The blueprint with the expression looked like this:

The blueprint with the expression looked like this:

Click to enlarge |

To create an expression of this type in Blueprints is easier to identify the latest operations to be done and create the blueprint in the reverse order that resolves an expression, in other words, start with the operation of lower precedence. In this example I started with the "+" operator, whose input values are the results of the small expressions that are inside the parentheses.