# Is there a way to store commands entered to be performed in that order?

**URL:** <https://forums.unrealengine.com/t/is-there-a-way-to-store-commands-entered-to-be-performed-in-that-order/331367>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE4, CPP, Blueprint, question\
**Created:** [September 7, 2015, 7:12pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-store-commands-entered-to-be-performed-in-that-order/331367 "2015-09-07T19:12:45Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![anonymous\_user\_359f4d3c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_359f4d3c](https://forums.unrealengine.com/u/anonymous_user_359f4d3c)\
**Post date:** [September 7, 2015, 9:47pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-store-commands-entered-to-be-performed-in-that-order/331367/2 "2015-09-07T21:47:52Z")

</div>

I don’t think there’s a direct way to store key presses up for later. If there is, I’d be glad to learn about it. 🙂

There a couple of ways to work around that, though.

The first idea that jumps to mind is to “convert” a key press into something more easible storable (like an enum value) and push it into an array of “queued” commands if a command cannot be executed right away. Then when the current action ends, you could get and remove the first element of the array (if it’s non-empty) and, depending on its value (for example using a Switch node), trigger the function the command would have triggered if it had been possible at the time.

If you only have a few highly specific situations where a given action might not be possible at the time but needs to happen later, you could also use _Gate nodes_. In response to the key press, add a Branch. If the action is possible right now, do that. Otherwise if the action will be possible later, _open_ a Gate. When the current action preventing the execution of the command ends, attempt to _enter_ the Gate. This will only execute if the player had pressed the other key earlier. After triggering the action, make sure to _close_ the gate again. You can also _close_ the Gate if the player does something else in the meantime invalidating the second key press.

[https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/FlowControl/index.html#gate](https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/FlowControl/index.html#gate)

For combo moves, you could also check out _Animation Montages_. Use _Branch Points_ to handle switching between different animations and _Anim Notifies_ to trigger specific effects depending on which animation is playing (like different amount of damage dealt, stunning the target or knocking the opponent a specified distance).

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...

> **[Animation Montage](https://docs.unrealengine.com/5.1/en-US/animation-montage-in-unreal-engine/)**
>
> Animation Montages are animation assets that enable you to combine animations in a single asset and control playback using Blueprints.

These are just some ideas off the top of my head. Which one works best really depends on the circumstances of your game. You might end up using a combination of all three or come up with something entirely different.

Good luck!

---

_[View the full topic](https://forums.unrealengine.com/t/is-there-a-way-to-store-commands-entered-to-be-performed-in-that-order/331367)._
