Here we will explore a complete example of the system.
We will create a
Action which prints some message to the screen after n amount of seconds.
Let's get started!
If your don't know how to create these head over to the respected sections and read them first.
Sub Action Implementation
It's always a good idea to start with the
Sub Action which actually hold the behaviour to execute.
Our intended behaviour should print some message to the screen after n amount of seconds.
Let's dissect that.
Secondsis a indication that this is a behaviour that needs to implement most of the logic in the
n Amountis a indication that these values should be dynamically set before execution
Sub Action Variables
As we dissected the specifications for our behaviour we need to create the necessary variables in the Blueprint class.
At first we add the
Timer variable which is just a simple float to count up to the intended amount of seconds (
Delay) we should wait to print the
Next, we need to store the
Message we want to print to the screen after the set amount of seconds (
Delay) have elapsed.
This variable needs to be Editable and Exposed on spawn.
At last, we need to store the
Delay after which we want to print the
Message to the screen.
This variable needs to be Editable and Exposed on spawn as well.
Sub Action Events
Alright, now that we got all the variables let's get to business implementing the actual behaviour.
Here we are setting up all the necessary things for the
- Reset of the
- An changing the
Can Tick = true
- Just to be friendly, we also print a little message to the screen to tell the player that we started execution
That's all for the
Execution event. Moving right along!
So, now to the
Tick event, this is where all the magic happens.
Here we need to keep track of the
Time and print the given
Message after the set amount of
Delay has elapsed.
After we did all of that we also need to explicitly tell the
Sub Action that we are done executing!
To keep track of time we just increment the
Timer variable every tick by the
After every increment we check if we are equal or greater then the set
Delay on the
Now, to the actual behaviour implementation.
We use the check after every increment (see above) to branch to the execution condition and print the
To be save we also include a
Do Once node, so that we can be sure the path is only executed once. Since we are in a ticking execution path.
Finally we need to tell the
Sub Action that we are done executing our behaviour.
Nothing easier then that!
Sub Action completed.
As the complete implementation is broken up above, here is the complete
Tick event implementation.
That's actually the simplest Blueprint of all, as this only constructs the above created
Sub Action and adds it to itself.
It also adds the dynamic values for the
Sub Action on construction.
This example is intended to be as simple as possible!
Action Queue Component Host Implementation
Finally we need to setup a
Action Queue Component host.
For this we use a simple
Actor that we can place in a level.
Let's start by adding the
Action Queue Component to the host
Begin Play Event
Finally we want to execute the above created system.
In this example we just added a
Q event which fires when the player is pressing Q on the keyboard.
To be able to use the
Q event in the
Actor you need to setup the
Actor to recieve input.
Here we just need to
Execute the above added
This can be achived in two ways:
That's it, now if you press Q it will execute! This is the final result.