Announcement

Collapse
No announcement yet.

Respawn in multiplayer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.
    Unreal Engine 4 C++ Programmer

    My projects:
    Ultimate Arena FPS

    Our Discord Server:
    Ultimate Arena FPS Discord

    #2
    Is this that hard to accomplish. Still waiting for a reply.
    CEO - AceGamer Network
    Our multiplayer FPS game: http://store.steampowered.com/app/436260/

    Comment


      #3
      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.

      Comment


        #4
        Originally posted by Xces View Post
        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:



        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.
        Last edited by Scienziatogm; 11-17-2014, 05:46 PM.
        Unreal Engine 4 C++ Programmer

        My projects:
        Ultimate Arena FPS

        Our Discord Server:
        Ultimate Arena FPS Discord

        Comment


          #5
          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

          Comment


            #6
            Originally posted by Xces View Post
            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
            The event is triggered, in fact if the player dies, it's unpossessed, but the new player isn't possessed again. Why?
            Unreal Engine 4 C++ Programmer

            My projects:
            Ultimate Arena FPS

            Our Discord Server:
            Ultimate Arena FPS Discord

            Comment


              #7
              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?

              Comment


                #8
                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

                Comment


                  #9
                  Originally posted by Xces View Post
                  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:


                  Unreal Engine 4 C++ Programmer

                  My projects:
                  Ultimate Arena FPS

                  Our Discord Server:
                  Ultimate Arena FPS Discord

                  Comment


                    #10
                    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.Click image for larger version

Name:	col.jpg
Views:	1
Size:	356.3 KB
ID:	1061235
                    Last edited by Zeb89; 11-19-2014, 01:45 PM.
                    CEO - AceGamer Network
                    Our multiplayer FPS game: http://store.steampowered.com/app/436260/

                    Comment


                      #11
                      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 .

                      Comment


                        #12
                        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?
                        Unreal Engine 4 C++ Programmer

                        My projects:
                        Ultimate Arena FPS

                        Our Discord Server:
                        Ultimate Arena FPS Discord

                        Comment


                          #13
                          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.
                          Last edited by Omar007; 11-21-2014, 09:13 AM.

                          Comment


                            #14
                            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.
                            KITATUS
                            "Information shouldn't be behind a paywall, It should be free for all!"

                            Comment


                              #15
                              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...SFPRiBpwe5sTwc
                              Lighting Technical Director | Co-Founder
                              Game School Online

                              Want to learn Unreal Engine 4 and game development from professionals that have worked on games at studios like Call of Duty, Battlefield, Last of Us, Riot Games, Blizzard, and more? Checkout Game School Online, the first ever fully featured, structured online game development training platform that is completely free, no strings attached: https://beta.gameschoolonline.com/

                              Comment

                              Working...
                              X