Trigger Task

Trigger Task 64 Trigger Task is a special function for change something in a level – when Trigger is activated.
In most cases it influence on Actors on the scene or a groups of Actors belonging to selected Spawn Points.

Every Trigger Task has its own specific configuration when you add it to the list.

Trigger Task - Details panel - 1.8.0 - RedBox

Trigger Tasks are very similar to Actions but they can be used only in Triggers.


There are 8 default Trigger Tasks

Trigger Task 32 Start – Start Advanced Control Points System.
  Task work on independent Actors and on selected groups of Actors belonging to Spawn Points.
  • Is First Start – when true, then activated Actor’s Advanced Control Points Components start Begin Actions. When false then Advanced Control Points Component start from Action on which recently finished.
  • Should Start All Belonging To – whether also start Advanced Control Points System on all groups of Actors belonging to selected Spawn Points.

Trigger Task 32 Stop – Stop Advanced Control Points System or destroy Actors.
  Task work on independent Actors and on selected groups of Actors belonging to Spawn Points.
  • Independent Actors – How to Act on independent Actors:
   a. Stop – Stop instantly Advanced Control Points System.
   b. Stop and Increase Action Index – Stop Instantly Advanced Control Points System and Increate Action Index if possible.
    It’s possible when it’s not last Action or Begin Actions of current Control Point.
    It’s useful when an Actor stops his Advanced Control Points System and we plan to start it again and continue movement from next Action (or Begin Action).
   c. Destroy – Destroy instantly all Actors.
   d. Ignore – Don’t do anything with Actors.
  • Belonging to Spawn Points – How to Act on all belonging to Spawn Points Actors:
   a. Stop – Stop instantly Advanced Control Points System.
   b. Stop and Increase Action Index – Stop Instantly Advanced Control Points System and Increate Action Index if possible.
    It’s possible when it’s not last Action or Begin Actions of current Control Point.
    It’s useful when an Actor stops his Advanced Control Points System and we plan to start it again and continue movement from next Action (or Begin Action).
   c. Destroy – Destroy instantly all Actors.
   d. Ignore – Don’t do anything with Actors.

Trigger Task 32 Destroy – Destroy all Actors.
  Task work on independent Actors and on selected groups of Actors belonging to Spawn Points.

Trigger Task 32 Run Action – Run any Action as Concurrent Action on all Actors.
  Task work on independent Actors and on selected groups of Actors belonging to Spawn Points.
  • Action – Selected Action to run.
  Be aware running Concurrent Actions on Actors in parallel to normal Actions can be unpredictable or even dangerous.
  You can read more about it in Concurrent Actions chapter inside Action page.

Trigger Task 32 Settings Override – Stop Advanced Control Points System and change all its settings
  Task work on independent Actors and on selected groups of Actors belonging to Spawn Points.

Trigger Task 32 Modify Trigger – Change settings of selected Trigger

Trigger Task 32 Player Enable Input – Enable or Disable player input
  This Trigger Task can be useful eg. when cutscene start/stop.
  Player can be chosen by:
  • Player Index
  • Controller ID (useful in multiplayer)
  • Overlapped Actor

Trigger Task 32 Print String – Print debug string
  Task print debug string on Screen or/and to Log.


Trigger Tasks order and executions

Trigger Tasks executing one by one, sequentially but do not (!) waiting for each other. So every Task will run its code in the same frame Trigger is activated.
Every Trigger Task has parameter Time to Activate which indicates the time after which will be executed counting from the start of the trigger.
When Time to Activate is 0,0 then it’s code run immediately in order of occurence in the Tasks array.


Parameters

Every particular Trigger Task has its unique parameters. But there is one equal for every Trigger Task:

• Time to Activate – Time after the Task code will run


Create custom Trigger Task

Trigger Tasks are designed to be easly created for your needs. To create new kind of Trigger Task which cover your needs, simply create child from CP_Trigger_Task or duplicate one of existing Trigger Task objects and modify. Its structure is fairly simple and intuitive.


1.

Firstly create new Blueprint Class by clicking on empty place in Content Browser.

Trigger Task - Create - 01

2.

In window Pick Parent Class, expand ALL CLASSES.

Trigger Task - Create - 02

3.

In ALL CLASSES search bar write base class CP_Trigger_Task.

Trigger Task - Create - 03

4.

Select destination class CP_Trigger_Task and click button Button Select.

Trigger Task - Create - 04

5.

Name new Trigger Task as you wish.
Here it was named CP_Trigger_Task_SunPosition.

Be aware when you create new object in content browser inherited from CP_Trigger_Task it will show you automatically on the list of available Tasks.

Trigger Task - Create - 06

6.

Open new Trigger Task object for editing.

Click to Functions -> Override -> Do Act

This event is fired on Trigger Task start.

Trigger Task - Create - 07

7.

Create very simple code connected to this event.

This code handles Time to Activate parameter of Trigger Task.
It is very important to start your custom code only from block Time has come – event.

8.

Task code use following variables:

  • Sky Directional Light (Directional Light object reference) – default value is empty (move it to category Configuration, set Instance Editable and Expose as Spawn on true)
  • Is Day (boolean) – default value false (move it to category Configuration, set Instance Editable and Expose as Spawn on true)

Trigger Task - Create - 09

9.

This simple code change Sun setting to day or to night – depends on parameter Is Day.

Code of course is very simple, but showing an example of Trigger Task.

10.

Inside Blueprint Editor of new Trigger Task. Click Class Settings in top belt.

Then choose Blueprint Display Name and write name you wish to see on Trigger Tasks list.

Next choose Blueprint Description and write name you wish to see on mouse hover in this list.

Trigger Task - Create - 11 RedBox

11.

Click on selected Trigger on the level.

In Trigger details panel add position to parameter Tasks.

Find our new Trigger Task in the list – wait a moment with hoover, and check description.

Trigger Task - Create - 12b

12.

We are ready to parametrize our new Trigger Task.

Trigger Task - Create - 13 RedBox

13.

Our Trigger Task during the action.

Trigger Task - Create - 14


Available events to override in CP_Trigger_Task Class

• Do Act – An event which run when Trigger Task start. This event run in the same frame Trigger is activated.
  > Trigger: IN reference to Trigger, owner of this Trigger Task.
  > Overlapped Actor: IN reference to Actor which overlap owning Trigger collision.
   Beware: this reference can be null if you activate Trigger manually.