Slowmo and Game Pause via Blueprints Tutorial

I wanted to slow down or even stop the time arbitrary for one of my hobby projects. I had no idea how to do it at that time and it took me a few hours to figure out how to do it and fix all the small issues I encountered during it. Unfortunately, I did not manage to find a single place where everything related would be described. So, in order to save someone else’s few hours of time, I want to share everything you should know to start working safely on your own slowmo scene or anything similar.

To begin with, here is an example of what you will achieve if you follow this brief tutorial:

Ok, let’s begin. I used first person blueprint template for this example map. Create a new first person project.

Then, you would have to set up your inputs to control the time. I assigned “P” to the pause (I called this action “Pause”), “O” to the partial slow motion (“Slow”) and “I” to the full slow motion (“SSlow” which stands for super slow as I lack creativity for a fancier name).

If you do not know how, go to the Edit->Project Settings->Input. There, under Bindings, press a plus sign next to the Action Mapping to add a new input. Make sure you have added all three buttons. Choose your preferred name and a key binding. It should look like this one:
bindings.jpg

When you are done with inputs, go to the Level Blueprint. Let’s start with a global slow motion. In order to do so, you will first need to add a custom event which is fired every time an associated key is pressed. Do so by right-clicking on the blueprint and either typing the name of your action binding or going to Input->Action Events->SSlow node. Your node would have a name you gave it in the previous step.

This will add a SSlow event to the graph. Add a toggle by connecting a “Pressed” output of the event to the Flip Flop node (Utilities->Flow Control->FlipFlop).

Next, connect the “A” and “B” outputs of the flip flop to two separate “Set Global Time Dilation” nodes (Call Function->Utilities->Time->Set Global Time Dilation) Set the Time Dilation parameter of the one connected to the output “A” to 0.1 and of “B” to 1. 1 means full speed and, as you can guess, 0.1 means a tenth of the full speed.

Now press compile and run the map. When you are ready, press “I” to see how suddenly everything is slowed down. Then press it again to return to the full speed. Cool isn’t it?

Before we make it even cooler, let’s implement a proper pause button.

Prepare the same set up as you did for the slow motion but replace the event with the one associated with your pause button. Change the time dilation in the node A to 0, compile and run the map. Unfortunately, when you hit the pause button, you can still see the ball moving. So, what’s happened? Well, “Set Global Time Dilation” node cannot set Time Dilation to 0 as it will break some internal logic and will cause many other issues. When you set it to 0, it will automatically defaulted to a very small but non-zero number. In order to truly pause the game, we will need a “Set Game Paused” node (Call Function->Game->Set Game Paused). Replace our “Set Global Time Dilation” nodes with the “Set Game Paused” nodes and put the tick in the box of the one connected to the output “A” of the flip flop connected to the “Pause” event.

Now, compile and try running a map again. When you hit the pause button, you will see the word “Paused” on the screen and everything will stop. Unfortunately, when you press the pause button again, nothing will change. Do not worry, it is easy to fix as this is the result of your input events not being executed during the pause stage.

Select the Input Action event associated with your pause button and under the Details panel, tick the “Execute when Paused” button like in an example below:
286d73872e3965bbde732a6867e9e69efbe77a12.jpeg

Hit compile button and run the map again. Now everything should work as expected.

Ok, now the cool part. What if you want to slow down everything but your own character? Easy!

Start by replicating the slow motion example with your own custom Input Action event. (Called “Slow” in my case) After that, add “Get Player Pawn” node (Call Function->Game->Get Player Pawn). Leave all the settings as they are. (A pawn is your in-game character and it is different from the player. For example, in a 3d person game, a pawn would have a different view from the player. Also, “0” is the default index of the player in the single-player game.)

Hold the output of this node, drag it away and release the mouse. Then choose the “Set Custom Time Dilation” node (Variables->Misc->Set Custom Time Dilation) to add it from the opened list. Connect the custom time dilation node to the “Set Global Time Dilation” node and then repeat the same for the second global time dilation node.

“Set Custom Time Dilation” node sets the value of the time dilation for the chosen target. In our case it is the player’s pawn. The custom time dilation is a multiplier applied to the global time dilation for the given target. Therefore, if we want to slow down the world by a factor of 10 but do not want the character to slow down, we need to set custom time dilation to 10. It will make it 10 times faster than the current global time dilation. Now, change the parameters of new nodes to 10 and 1 for the branch “A” and “B” respectively.

Compile and test the map. You are all set now. You can hit your “Slow” button and start outrunning the bullets.

Also, you can use the same set up to become super fast. This set up has a deliberate bug to show you how you can make yourself much faster than everything else in the world. If you first hit “I”, then “O” and then again “I”, the global time dilation will return to 1 but the local one will remain at 10. This is the result of how we used flip flops. If you want, try to fix this issue on your own as an exercise.

Here is the final arrangement of all the nodes:

TL;DR

  1. Set up inputs like in the first image
  2. Arrange your graph in the blueprint like it is in the last image
  3. Change your custom Input Action event for the pause button to execute when paused like in the second image.
  4. Enjoy!

I hope I helped at least someone. Have a good day!

1 Like

Set custom time dilation doesn’t have a target node, is this only in previous versions? I’m using 4.3.

*Edit: I had to check context sensitive, there are two different versions of that node! Thanks for the tutorial, works great!!

I followed this and it worked great, the world slows down and my character stays at the same speed. How would i get an AI enemy to also remain at the same speed once the world slows down?

This is awesome, thanks so much for the effort and work!

This should get interesting in a third person shooting game like bulletstorm or timeshift style as a spell that consumes mana, and you keeps for special occasions.

Thanks Russ:)

First post in Great Style!

set their custom time dilation to a multiple that offsets how much you slowed the world down (world at half speed {.5} then enemy twice as fast {2}) …

how can we setup unpause time with delay…

i wanna stop game just 0,1 second when i hit then resume

You would use a delay. You would set the time dilation after unpause to 0.1 for slow mo then set a delay node of 0.1 and then set time dilation back to 1. I think.