Locking Controls During Instruction Screens, Multiple Screens (UE 4-27)

I’m trying to use widgets to display images in a particular order, to provide instructions on how to play the game. I’ve gotten importing images and making widgets of them down, but I want to lock all player’s controls (including moving the camera around) while an image is displayed, ten seconds before the player can press Enter to close the image and nothing else. Then, after the image is gone, the player’s controls should be enabled. I also want to be able to have the game show one image then the next and the next before the game is ready to begin.

So, how do I lock all controls besides pressing Enter to advance after ten seconds of reading the messages?

Also, what would be the best way to make one image appear then the next? I’ve thought of piling them with the exact same size and positioning coordinates, before adding a Remove All Widgets node.

I figured out how to put in multiple windows in the right order. I’m using an integer counter to determine which window comes next when the player presses Enter. So, this is partly solved.

But what about locking all controls, including camera movement, while the instruction windows are on the screen?

I decided to make separate maps just for the introductory and instruction screens, which will then take the player to each level.

You can use a simple boolean check on each control before making them able to do something.

“Set Input Mode UI Only” might be what you’re looking for?

1 Like

I did figure out an alternative solution, though it would still be a good idea to try that for future reference. At any case, thank you and Lorenze for the feedback.

You can also push an input component onto the player controller input stack that blocks input to things below on the stack.

Normally you can have a stack of inputs that go top to bottom until an input isn’t handled. I’m not sure how easy it is to do it in Blueprint but it’s a few lines of code in C++.

This can be easier than using Set Input Mode UI Only since you now are able to have fully working gamepad and keyboard inputs on a special screen while the game is unaffected and unpaused.

Oh also you can pause the game.

1 Like

I tried that more recently, but the controls act weird between when I use the “Set Input Mode UI Only” and “Set Input Mode Game Only” nodes. As if the character sort of moves on its own and the controls are briefly scrambled.

Do you have any examples on the player controller input stack suggestion? Also, I tried the Pause Game node, but I don’t think I can use the correct item as its target.

I did it in C++. It was actually very simple.

When you have access to the player controller reference, you push an Input Component.

It’s what happens under the hood for you normally as you possess a pawn or some actor has input events registered.

I’d provide an example but my example is 1 line of code.

I did create an InputComponent in the HUD actor and I bound keys to it.

GameScreensInputComponent = CreateDefaultSubobject(TEXT(“GameScreensInputComponent”));

1 Like

Actually, I did find one other way: by using the Disable and Enable Inputs and connecting Get Player Character and Get Player Controller to each.

1 Like