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 text
asked Aug 28 '15 at 02:42 PM in Blueprint Scripting
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.
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:
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:
PS: Try cropping your screenshots. They've got these huge white borders right now.
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.
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.
answered Mar 08 '16 at 01:21 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here