x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

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!

alt text alt text

Product Version: UE 4.15
Tags:
knightbp.jpg (290.0 kB)
more ▼

asked May 15 '17 at 06:40 AM in Using UE4

avatar image

Nosh88
48 2 4 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Aha! Disable input was not working no matter what way I swung it, so what I did was made a branch on my movement and input commands that checked whether or not the player could move. If they could move then execute the input, if they couldn't move then do nothing. Then, I made it so when the character was dashing it would set the can move boolean to false, play the animation, launch the character, and after a short delay set the boolean to true.

more ▼

answered May 23 '17 at 05:02 PM

avatar image

Nosh88
48 2 4 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

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.

more ▼

answered May 15 '17 at 06:50 AM

avatar image

Erumaru
630 12 14 52

avatar image Nosh88 May 15 '17 at 07:18 AM

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.

avatar image Erumaru May 15 '17 at 07:24 AM

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().

avatar image Nosh88 May 15 '17 at 07:33 AM

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.

avatar image Erumaru May 15 '17 at 07:39 AM

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?

avatar image Erumaru May 15 '17 at 07:42 AM

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

avatar image Nosh88 May 15 '17 at 07:53 AM

alt text

alt text

alt text

dashfunction.jpg (276.1 kB)
dashstart.jpg (218.7 kB)
dashstop.jpg (269.5 kB)
avatar image Erumaru May 15 '17 at 09:21 AM

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

avatar image Erumaru May 15 '17 at 09:22 AM

Nvm, I have understood.

avatar image Nosh88 May 15 '17 at 07:42 AM

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

avatar image Erumaru May 15 '17 at 07:43 AM

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

avatar image Nosh88 May 15 '17 at 07:54 AM

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

avatar image Erumaru May 15 '17 at 07:47 AM

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.

avatar image Erumaru May 15 '17 at 09:30 AM

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.

avatar image Nosh88 May 15 '17 at 03:56 PM

Ill restructure and see how it goes, thank you

avatar image Erumaru May 16 '17 at 09:00 AM

How do you do, man?

avatar image Nosh88 May 17 '17 at 05:10 AM

Well I tried restructuring, still no luck.

avatar image Erumaru May 22 '17 at 05:21 AM

Do you steal facing this problem?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question