Respawn in multiplayer

Hi, how can I make a respawn system in blueprints?
I did a Death event from the Event Any Damage, but I can’t get the Player Controller of the damaged actor.
Is there a way to do it?
Thanks in advance.

Is this that hard to accomplish. Still waiting for a reply.

Since your damaged actor needs to be a pawn you can get its playercontroller with “Get Controller” and cast it to playercontroller. Then you can spawn a new pawn and possess your playercontroller.

I did this:

http://puu.sh/cUZfW/33a92a3b38.png

But it doesn’t work. The FinishedDeathAnimation event is called from the Animation Blueprint. When the player dies, it doesn’t possess the new pawn.

I think the finish Animation Event will only been called on your Clients so your respawn Event (replicate if server) will never trigger. (you can test it with “print string”)

Atm im not sure if ist enoght to spawn the new pawn only on the server or if you need to spawn it everywhere. I have no ue4 here but i will try it out in the afternoon :o

The event is triggered, in fact if the player dies, it’s unpossessed, but the new player isn’t possessed again. Why?

I’m not too sure about the whole playercontroller on multiple clients yet, but I think the problem here is that since the respawn is executed on the server the possess node doesn’t know which playercontroller to possess to. What you need to do is add an input in the red respawn node of the type controller. In the blue respawn node you will now be able to drag from the “get controller”-return to the new input (after you’ve compiled, and possibly right clicked and refreshed the node if it doesn’t show up).

Now you can drag from the playercontroller input to the possess and unpossess nodes instead of self and it might work?

ok I tried it out and the following works for me


just spawn the new pawn on the server and replicate an event to your clients which finally possess

Thanks, it works! But when the player dies, the collision remains, even if I do this:

http://puu.sh/cXe5t/f54cf6807a.png

http://puu.sh/cXe75/0d1e7c0d91.png

So basically when a player is killed, the capsule component collision doesn’t get removed. We need a working blueprint system to get rid of it the moment the player dies.

look like you destroy the actor only on your client. Im not sure if its enough to destory it on the server only. just give it a try :).

If I destroy the actor, the collision component disappears. The problem is that I want the actor in ragdoll without collisions. How can I do it?

You’d want to do something like this:

  • Use the CollisionsEnabled node and set it to false, then call the CollisionResponseToAllChannels and set it to Ignore (call both on the capsule component).
  • Enable collisions on the Actor itself (SetActorEnableCollision).
  • Enable ragdoll mode (in C++ this would be simulate physics, all bodies simulate physics, wake all rigid bodies, set collision profile name (on the Mesh Component))
  • Maybe disable the movement component (StopMovementImmediately, DisableMovement, TickEnable to false?) or you’ll still be able to move around.
  • Set the actor lifetime so it destroys itself after the given period.

How about this:

Player Dead? - Yes = Set Ragdoll. After X amount of seconds, set visibility (Invisible) and move actor to location (On Random INT), Set Health back to 100, ammo back to 100 and after X seconds set visibility back to on and give the movement back.

Then simply add “Is Dead?” to every moment button in your Blueprint then your players can’t move when their dead and can still respawn even though their characters are not technically dead, they will appear dead.

a) if you want to keep the ragdoll pawn and no collision component (which makes sense for 99% of games) you need to explicitly destroy the capsule component as soon as the pawn goes in its death state (using a bool is a good bet)

b) this will only work in single player; for multiplayer, you will have to replicate this functionality to all clients (Multicast)

If you’re unfamiliar with network replication, go over this information over and over until you “get” it: https://docs.unrealengine.com/latest/INT/Videos/Player/index.html?series=PLZlv_N0_O1gYwhBTjNLSFPRiBpwe5sTwc