Lock Player to UI Only Input

So I’m trying to make the player, when interacting with a certain NPC, to be locked down to place, and be able to move with specified arrows through the UI that will be presented to him, how would I go about doing that?

Also, currently I’m having a problem with my blueprint, as you can see below, when I press the interact key, the widget that’s supposed to appear only appears when I back away and go to the NPC location, how would I go about to fix that so it appears straight away.

First of all the way you are reading isInteractPressed is not a good idea, you might have problems. Anyhow, you should look to override Key Down event and check if an arrow event is pressed, and handle it accordingly.

[=DjSt3rios;619159]
First of all the way you are reading isInteractPressed is not a good idea, you might have problems. Anyhow, you should look to override Key Down event and check if an arrow event is pressed, and handle it accordingly.
[/]

How can I go with the IsInteractPressed so it doesn’t have problems then?

Hold down CTRL and drag is Interact Pressed on the event graph. Then connect it to the branch.

[=DjSt3rios;619447]
Hold down CTRL and drag is Interact Pressed on the event graph. Then connect it to the branch.
[/]

When I drag it into the event graph, it just gives me the normal options.

If you see “get” and “set” select get. Then connect it to the branch :slight_smile:

Regarding the input lock you have an option called “InputEnabled” I believe it is on the player controller. You can disable / enable it at runtime. In your case it looks like you’ll be deactivating it when the player starts interact and reenable it after the interaction is complete. There is also a “SetInputModeUIOnly” in the player controller, you might want to play with it.

[=DjSt3rios;619741]
If you see “get” and “set” select get. Then connect it to the branch :slight_smile:
[/]

Now when I walk near the NPC, it automatically triggers the thing after supposedly pressing the Interact key (if I have it checked, and the contrary if I don’t), how do I check to see if the player presses it?

you can use Left Mouse Button or something to make it true/false. Make it true on Pressed, and false on Released. There must be better ways to achieve this but it depends what you are trying to do.

Hi BlizKrut,

In the blueprint event graph, you can call a node called “Set Input UI Only”, which will allow you to prevent additional input from occurring. you can also use “Set Input Game Only” for the opposite, or “Set Input Game and UI” if you have input from both needed.

[= ;620283]
Hi BlizKrut,

In the blueprint event graph, you can call a node called “Set Input UI Only”, which will allow you to prevent additional input from occurring. you can also use “Set Input Game Only” for the opposite, or “Set Input Game and UI” if you have input from both needed.
[/]

Yep, that worked out great, I also managed to check if the key was pressed, just used “Is Input Key Down” :slight_smile: