sexta-feira, 29 de abril de 2016

BP Compendium 2: Actions


Actions are used to define the behavior of a Blueprint. Actions always start from an Event. The main types of Actions are changes in the variables of the Blueprint or function calls that modify the state of Actors.

For example, imagine that a Blueprint has an integer variable called "Ammo". To initialize this variable with the value "50" when the game starts use the Event "Begin Play". Drag the "Ammo" variable to the EventGraph using the "Set" option:

Each event can be added only once in the EventGraph. To use more than one Action for a specific Event it's necessary to put the Actions in sequence. The image below shows the initialization of two variables.

Click to enlarge

The functions allow values ​​to be passed through the use of parameters. Most functions has a parameter called "Target". This parameter indicates the Actor to be modified by the function. The default value for this parameter is "self" which is a special reference to the Actor that owns the script being executed. 

The images below show different ways to use the "Target" parameter of the "DestroyActor" function when an overlap event happens. In the example that uses "self", the Actor that has the script will be destroyed. To destroy the other actor who was part of the collision use the reference "Other Actor" of the event. In the last example, the actor who will be destroyed is the one referenced by the variable "Item BP."

Table of Contents