How can I stop player movement while UI widget is on screen?

Im trying to create a level where the player can talk to an npc, so a Ui window shows up with a quest, and the player can choose if to accept or decline it.
This is what I used to make the NPC check f the player is close enough to talk to it:

Then I tried adding the widget blueprint to the viewport, and to stop the player’s movement and rotation like so:

The “Player” variable is a reference to the third person character, and the “CanMove” and “CanRotate” are set like so:

I’d show how I set the “CanRotate” if I didn’t alraedy used to many attachments, but the point is that I tried manually setting those two variables to false just to see what happens, and the player could not move or rotate.
Currently, I can activate the UI screen, but the player movement does not stop.

Basically, what I’m trying to do is to set both “CanRotate” and “CanMove” to false whenever the player activates the UI screen, but for some reason theose two variables always stay on true.
If anyone can show me how to fix this I’ll be really grateful ^^

**Note: I checked with “Print String” if the player NPC knows that the player gets in and out of the conversation trigger area, and if the button press works, and so far it works. I know I still have to add more things but this is all I got so far…

1 Like

I see you setting CanMove and CanRotate, but not in the player. Am I missing something?..

I’m not sure what you mean…
player is just a reference to the third person character where the values are sitting, so there’s no other place to set them.
the setting of the values to false is supposed to happen in the NPC blueprint, if that’s what you meant.

CanMove and CanRotate are variables sitting on the third person charcter movement, and the seting of them to false happens on the NPC blueprint.

Two step process

  1. Get character movement component → Set Velocity 0,0,0

  2. Get the controller and Set Ignore Move Input, Set Ignore Look Input both to true. (you can use your Can Move variable but its cleaner to use the built in variables in the controller)

2 Likes

It works! Just what I neede, thank you so much for your help ^^