How to disable input in PlayerController class from CharacterBP?

Hello!

I have created myself a dash ability for my character using the “Launch Character” function in my Character blueprint. Now all of my characters input is handled via a PlayerController blueprint, and I was trying to find a way to disable the input from the player controller from my character blueprint. I have tried to just disable input once the “Dash” command is called from the character BP and connect the player controller that way, but nothing seems to work. Any knowledge on this would be greatly appreciated!

Create some boolean in your PlayerController, for example with name canMove. Then in both Inputs check is it true, then continue your logic. The last thing you should do is to flipflop value of this boolean when u use Dash. If I understand something wrong, tell me please.

I’m giving that a try right now. The only problem I am having is how to call whether or not the character is dashing from the character blueprint into the player controller. I plan to have several characters that the player controller commands, and each character has their own blueprint - that is why I don’t want to run everything out of the controller if necessary.

You can create event dispatcher in PlayerController, then call them in your Character blueprints. However, what is wrong with my previous solution? You can just call some function in your characters like GetController() → CastToPlayerController() → FlipFlopDash().

What I tried first was to add a branch off of my input axis, and called the condition “Can Move” from my CharacterBP, and set the rest of the logic to fire off of if “Can Move” is true. However, now my character will not move even when I use my dash ability :(. I think I’m misunderstanding what you are saying to do.

Hm, I think you are doing something wrong. By the way, you are calling function GetPlayerPawn(0) in your bp, on server it will return first players pawn, I don’t think you want it to work this way, no?

I need some more details. Where is your Dash function that you call after input?

I do not want it to work that way, you are correct.

Better to use GetControlledPawn(), because this is PlayerController it would return pawn u are possesing.

In addition, you should remember that all your inputs called on client. If you want them to work at server, create event which will pass them here.

Thank you for that tip! Will fix that quickly :stuck_out_tongue:

You call dash start, then it calls srv_dashstart, then it calls dash start again? Why doesn’t this bring infinite loop?)

Nvm, I have understood.

Firstly, your moveForward and moveRight events called only on client and branch with authority will never fire. It means that your character won’t move on server. Secondly, if you want to stop movement on both client and server, you should make your variable canMove replicated. Make some event that would pass your input to the server. I am thinking about what’s wrong with your dash, give me time.


UPD: I think if you properly structurize your event calls in terms of client/server, your problem will disappear. Let me know, if it wouldn’t help.

Ill restructure and see how it goes, thank you

How do you do, man?

Well I tried restructuring, still no luck.

Do you steal facing this problem?