Trying to disable player movement and then reenable after interaction

Hello! Please be wary that I am sort of still new to Unreal, so I apologize if I don’t get things down at first. Currently following a mish mash of tutorials as reference guides.

“I want to have an interaction system where the player can talk with NPCs and not move when engaging in talks, and then be able to move again when finished.”

I have an interface set up called “Interact”. Whenever the player presses to talk near an NPC, the NPC goes through an array of string elements that is displayed on a WB textbox UI that also pops up. I’ve set new limits and new starting points for my index if I want to engage in another conversation with the NPC with new dialogue, also grabbing dialogue from the dialogue array. The dialogue system itself works fine.

However, I want to disable the player’s movement without disabling their input as they would not be able to press and advance to the next array element/dialogue line. Then, I’d like to reenable the player’s movement after finishing a set of dialogue. Does anyone have a good approach to this? I haven’t been able to quite figure it out for a while.

In Player’s BP:

NPC’s BP

The Array of Dialogue:

This is the dialogue logic just in case:

Hey @Botnical welcome to the forum!

You have multiple options to achieve this.

  1. The easiest one, disable Player Controller’s input


    Using SetIgnoreMoveInput you prevent the player from being able to move, and using SetIgnoreLookInput you prevent the player from moving the camera.

  2. If you are using UE5 and EnhancedInput


    You can create a IMC (Input Mapping Context) only for Interaction, or with all controls except for movement and camera rotation and add it to the controller.

Then, add or remove the normal IMC with the movement inputs depending on your interaction state.

  1. Change controller
    Another option is to have a different controller with whatever inputs you want to have available during interactions, then use that controller when Interaction begins and switch back to the “normal” PlayerController when the interaction ends.

Whatever you choose depends on your preference and needs for the project, but all three options would works.

1 Like

you’re the best, thanks a lot!