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"

Teleportation in Multiplayer

Hello, I recently started to create a multiplayer game and knowing nothing about programming I used the BP system. Now when I try to teleport my character as a client I only teleport for the briefest of moments like a tick or so and then I get back to my origin position. When running on the server however it works perfectly. Same thing happens when I want to destroy an actor: works on server but no on client. I want to create an respawn system where the character is destroyed and then created and teleported to the spawn position. I tried using this system both in the level blueprint and thirdpersoncharacter BP. I recreated the basics of the system in a new thirdperson project and encountered the same problem. So after looking around on the internet and rewatching all the guides I can't seem to solve the issue. I hope you can help me in my struggle. Thanks in advance!alt textalt textalt text

Product Version: UE 4.8
Tags:
bp_teleport.png (128.4 kB)
problem2.png (89.2 kB)
bp_teleport.png (128.4 kB)
more ▼

asked Aug 28 '15 at 02:42 PM in Blueprint Scripting

avatar image

Notti
6 1 2 3

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

2 answers: sort voted first

Since the actors are replicated from the server to client (not the other way around!), you'll need to execute all actions that should affect all players on the server.

Basically, in addition to the Teleport function, create a custom event (in the same Blueprint) that calls the matching function. In the Details panel of the event, set the Replicates property to Run On Server. Then replace your current function call with a call to the event instead.

alt text

The server will take care of moving the character and then, because the characters and their movement are replicated, inform all clients about the updated location.

The same applies to spawning and destroying actors.

I found this video series extremely helpful:

https://wiki.unrealengine.com/Videos?series=PLZlv_N0_O1gYwhBTjNLSFPRiBpwe5sTwc

Also, right now your characters will always teleport into a fixed direction. If you want to make this depend on their current rotation, you can use the GetForwardVector:

https://answers.unrealengine.com/questions/291875/blinkteleport.html

Good luck!

PS: Try cropping your screenshots. They've got these huge white borders right now.

more ▼

answered Aug 28 '15 at 04:07 PM

avatar image

erinacea
1.8k 68 28 112

avatar image Notti Aug 28 '15 at 11:22 PM

Thanks Alot! Worked like a charm. WIll definetely take a look at the tutorial again. Take care and once again thanks!

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

I seem to be having a similar issue, that this soluition did not solve.

I am trying to create function in which the player can push a button that will teleport them to a room, and then the same button teleports them back exactly where they came from.

This is the blueprint I am using on the level.

alt text

The teleporting works perfectly for the first player but any other player who connects to the level does not teleport.

It seems to me I have to somehow reference which player is calling the teleport function? perhaps with the player index? I dunno :(

any help would be great.

Thanks

capture.png (295.8 kB)
more ▼

answered Mar 08 '16 at 01:21 AM

avatar image

UofA TALS
15 2 4 6

avatar image indygoof Mar 08 '16 at 11:56 AM

You should code stuff like that in the Level Blueprint. The Level Blueprint is the same instance for all players in multiplayer, and you are referencing the PlayerPawn for the Player number 0 directly.

It would be better and easier if you would code this in your playercharacter directly.

Cheers, Indy

avatar image UofA TALS Mar 08 '16 at 09:16 PM

I tried that, and had difficulty referencing a target from within the player....

I'll try again, I suppose. :/

avatar image UofA TALS Mar 08 '16 at 10:50 PM

Ok. Got 'er going... thank you.

This incorporates my needs and the fix required to make it work in multiplayer

alt text

capture.png (278.5 kB)
(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