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"

Changing Movement Mode affects other characters

Hi everyone,

I'm working on a game where you can switch between 3 characters at any point during runtime. The 3 characters are children of a master character BP and share the same functionality. This master character BP is based on the ThirdPersonBP from the normal template.

I have a CharacterSelect blueprint with the following functionality:

alt text

On Event Begin Play I get the references to all characters in the level like this: alt text

Then when the Player presses 1,2 or 3, it possesses the appropriate pawn: alt text

I also have a simple water blueprint that changes the Movement Mode of the Character on overlap: alt text

Here's the issue:

When Movement Mode for one character changes, the Movement Mode for the other 2 changes as well as soon as I possess them! If I jump and switch in mid air, the character STAYS in mid air. If I set the Movement Mode of one character to Swimming...the Movement Mode of any possessed pawn will also change to Swimming.

Is as if the Character Movement that I reference is changing at the parent level and not the child level (even if I specifically reference the child)

Please take a look at this 1min video to see what I'm talking about: **Youtube Video**

Can anyone tell me what Im doing wrong here? I want to have one character swim, while the others walk / jump independently.

Really appreciate any help!

Thanks!

-J

Product Version: UE 4.12
Tags:
switch2.jpg (103.4 kB)
switch1.jpg (174.6 kB)
switch3.jpg (246.3 kB)
water.jpg (238.9 kB)
more ▼

asked Jan 13 '17 at 06:01 PM in Blueprint Scripting

avatar image

CoquiGames
63 2 3 9

avatar image TheWTFage Mar 13 '18 at 07:45 PM

I filed a bug report because I'm having similar issues: https://issues.unrealengine.com/issue/UE-54905

avatar image TheWTFage Mar 13 '18 at 07:47 PM

UE-54905 Useful information for this bug in this thread.

avatar image CoquiGames Mar 20 '18 at 01:59 PM

Thanks! Hopefully this gets addressed in a future release - its quite surprising they didnt anticipate this usecase.

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

In the definition of ACharacter (the parent class of ThirdPersonCharacter) in Engine/Source/Runtime/Engine/Private/Character.cpp about line 1003 (in branch 4.15 at the moment) it has:

 //
 // Static variables for networking.
 //
 static uint8 SavedMovementMode;

So, your result is not surprising. The ACharacter parent class stores the movement mode in a static class variable that would affect any and all instances of the class or any subclasses.

I don't know much about the networking side of C++ (yet), so I couldn't say if they really need that variable to be a static class variable in order for it to replicate across the network, but that's what's causing the behavior you see.

more ▼

answered Jan 13 '17 at 07:12 PM

avatar image

CleanCut
2k 65 82 77

avatar image CoquiGames Jan 13 '17 at 08:42 PM

Thank you for your answer CleanCut! I haven't looked at C++ in UE4, just learning Blueprint. From your answer it sounds like what I want to do is not possible if I'm using the Character class. I'm very surprised that this is the case, but perhaps there is a reason because of multiplayer.

Do you have any suggestions besides changing source code or using the Pawn class to achieve this?

Thanks again for your hep!

avatar image CleanCut Jan 13 '17 at 10:32 PM

Well, if you are looking for something to be done in blueprints then the only thing I can think of is making your own Pawn subclass blueprint and implementing all of the character functionality by yourself (probably a pretty massive undertaking).

If you are willing to build your engine from source you could experiment with some simple tweaks and see if it works for you. For example, if you aren't using networking maybe it will "just work" if you remove the static keyword from that line I mentioned so that the movement mode is stored per instance instead of globally in the class.

avatar image CoquiGames Jan 14 '17 at 08:21 PM

Thanks for the clarification CleanCut. I think both options are probably too much for me at the moment. I ended up restricting when you can switch characters to prevent those issues.

Thanks for your help!

(comments are locked)
10|2000 characters needed characters left
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