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"

Why target variables have different values?

I want to do the possession in multiplayer. When i came near the car from the server or from the client the target takes different values. alt text

alt text

Product Version: UE 4.18
Tags:
3.png (168.0 kB)
4.png (84.1 kB)
more ▼

asked Aug 26 '18 at 03:12 PM in Blueprint Scripting

avatar image

KyklsDro
9 2 1 5

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

1 answer: sort voted first

Player Controllers are never the same object between server and client, even if it represents the same player. At least not in my experience, so unless you're getting weird behavior this is probably okay.

Even though they are different objects they have the same connection via the Player though, which is why RPCs work through player controller and actually hit the correct player controller object on both sides.

I may have this wrong but when i treat it that way my network game works properly.

more ▼

answered Aug 26 '18 at 05:34 PM

avatar image

mightyenigma
3.4k 16 17 12

avatar image KyklsDro Aug 27 '18 at 05:20 AM

And what i need to do? I need that the server and the client can drive on the same car.

avatar image dZh0 Aug 27 '18 at 01:20 PM

The possession happens (Possess event) only on the server so it doesn't matter if the controller objects are different. They are replicated so even if the names differ the values are kept synchronized by the engine.

The server should automatically notify the client controller that the player pawn is changed and the above scheme should work.

Is there a specific problem coming out of this?

avatar image KyklsDro Aug 28 '18 at 03:19 AM

Thank you, I understood. I have error and warning that i dont know how to fix. Can you help me? On the first and second picture ThirdPersonCharacter. On the third ThirdPersonGameMode. ThirdPersonCharacter

ThirdPersonCharacter

ThirdPersonGameMode

7.png (186.7 kB)
8.png (94.5 kB)
9.png (147.5 kB)
avatar image SenToRious Aug 28 '18 at 03:58 AM

You're casting self (Character) to a player controller which is totally different, instead of self GetPlayerController > Cast to >> MyPlayerController.

avatar image KyklsDro Aug 28 '18 at 04:54 AM

Thanks, it fix the warning, but how to fix the error?

avatar image SenToRious Aug 28 '18 at 03:32 PM

Get Game Mode > Cast to ThirdPersonGameMode > the result of the cast is the target in your event with the error.

avatar image KyklsDro Aug 28 '18 at 05:35 PM

Thank you! It helped.

(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