4 actions to trigger an event

I’m very new to UE4 and Blueprint. For a little game I’m making for my daughter, I’m looking for help.

On the map, there is a cube. On it I’ve put a box trigger. The player must go on this cube and then make 1 jump, two shots and one more jump to action an event (it’a a sequence that’s already working well).
The caracter jumps when hitting the space bar and shooting with mouse left click.
On my level blueprint I have “onactorbeginoverlap” set for the trigger box and, at the end of the chain a “sequencePlay”.
But in between, I don’t know, and can’t find how to implement the 4 actions sequence…
Thanks for your help.

Having a LITTLE trouble understanding but let me try to figure this out.

So you want the player to stand on the box then perform the following actions in order:

  • Jump
  • Shoot
  • Shoot
  • Jump

If the player breaks this sequence, does it simply wait until the correct action is performed or does it make them start over? Also, I don’t think “sequencePlay” is what you’re looking for here.

The way I would set this up is first creating an enum for your action types. A quick overview of enumerators can be seen here: (although I think the location in the context menu has moved since this video was taken though I’m not 100% sure where it is now without looking myself). I would add options for “Jump” and “Shoot”.

Thinking about this, I personally would not put this in the level blueprint. If this is a puzzle element, I would create an actor to handle it so it is encapsulated from the rest of the level. You could create a new actor with a cube in it and your trigger box.

Then, in your cube blueprint, you can create an array of the type of the enum you created. This will allow you to specify a sequence of events. Adding 4 elements and setting them to Jump Shoot Shoot and Jump should work.

Lastly for the setup, create a integer variable to use as your iterator, defaulting to 0.

For your OnActorBeginOverlap event, simply set the boolean variable to true. Create an OnActorEndOverlap (I think that’s what it’s called) and use it to set the boolean variable to false.

Now you need a way to communicate with the puzzle cube so when the player jumps, tell the cube “I jumped!”. One way to handle this would be to create an event in your Character blueprint, call it something like “Performed Action” and add an input node for the action enumerator. You will need a call to this event after the Space/Jump event node that will already be in this graph as well as the Left Click / Shoot node. Just make sure that you pass Jump in when jumping and Shoot in when shooting.

Now that the events are being tracked in the player, you need to tell the puzzle cube what you did. So you could create an identical new event in the cube blueprint, called “Performed Action” with the action enum as the input. Back in the character blueprint in the “Performed Action” node there, you will need to add a GetOverlappingActors node (filter on the class of your puzzle cube). Assuming the player will never be able to overlap with more than one puzzle cube at a time, there will only ever be one result from this node despite it being an array. First, check the array length. If it’s 0, this means the player performed an action without being in the cube so nothing needs to happen. Otherwise, get the first result from this array which will be a reference to a puzzle cube. Call the “Performed Action” on this result and pass the enum from the event here to the new event.

In the “Performed Action” node on the cube, you will now be able to decide what will happen when the player performs an action within this cube. Grab a reference to your enum array and get the element at the location of your iterator variable (will be 0 the first time through). Then, compare this enum to the one passed into the event. If they are equal, add one to your iterator enumerator variable. This means the player performed the correct action. You should then check if the iterator equals the last index in your sequence array. If it does, the player has completed the sequence and you can decide what happens next. If the enumerators are not equal, you can decide what happens. You could do nothing (so the player can keep trying until they get it right) or you could reset the iterator to 0 (so the player needs to start the sequence over). I would probably accompany these actions with some kind of visual or audio feedback (maybe a “ding” for a correct action and a “buzz” for an incorrect one) otherwise it will just feel like random actions.

I’m sure I made this sound much more complicated than it is. Let me know if you have any questions or if you wanted to focus on a different direction and I can help further. I could also demo a few things if needed later.

There is a simple way to build this for now, especially when prototyping (no need for enums). Its a more human friendly approach for troubleshooting. Basically, just assign a short string for each action (jump shoot etc), and then append this to a master string. After each event, search the master string for the unique code that represents all 4 actions that you want to trap on…

Current Key/Button Press or Overlap event

Concatenate this or whatever the current action is (Jump / Shoot) to the master string below and then perform a simple string search for the chosen unique code:


I’d go with booleans being triggered instead, the master string seems like a possible hack waiting to happen when you utilize it for different things.

onbeginoverlap you start the checking. each action needs to be completed in the specific sequence so you can branch trigger each individual state, and if at any point the check returns false you reset all the booleans requiring the whole thing to start from scratch.

This way you can also keep it Visual and BP friendly.

Generally, you can access what the character is doing by the booleans you already normally add to the BP - which if you don’t add them you should:

I would also go with an enumeration. Make an array with the correct sequence and add your actions to another array. every time an action is added loop through all the actions done so far and if they don’t match you can post which one didn’t match.

You can also do all the actions first and then compare if they are correct. Then just clear the actions done array and you are good to go for a retry.

Could you elaborate on that?

Hi guys. First of all I would like to thank you for your support and the time you’ve spent for helping me.
Mr Chumble : you absolutely well understood what I wanted to do and I look forward trying to build my blueprint on the basis of your advises. As I’m very curious to learn, I’ll probably give a try to all the methods that were proposed on this post. I will let you know if I can get it.
So one more time thank you for your help and patience (english is not my mother tongue and I know I sometimes have difficulties to be understood). See you !!

Hi Graphenes. I think I could do something with your solution. But I’m unable to find the name of the node you use to compare the 2 arrays. I tried “equals”, “compare” ans some other words but nothing looks like the node you have on your picture. Thanks for helping and best regards.

Since you want do something similar to a special attack from those beat em up games, where you have to use a certain combination of controller buttons to activate those special attacks, maybe you can use one of their features to trigger your events? There exist an input buffer plugin for those special attacks, maybe you can look at that and modify it, that it also records other actions too for your trigger?