Announcement

Collapse
No announcement yet.

make Apply Damage node replicate?

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

    make Apply Damage node replicate?

    so i'm very new to UE4 and i know that a multiplayer game isnt the best place to start, but i don't really have any drive for a single player game. Anyways, i'm making a shooter and long story short, is there any way to make the node "Apply Damage" replicate? i have everything set up, the only problem is that the server can give damage to the client but a client can't give damage to the server.

    #2
    ApplyDamage is run on server per default because it is a pretty important gameplay mechanic. Such things shouldn't be done by any clients. You should replicate your health variable instead and then it should work.
    Twitter | Multiplayer TopDown Survival Kit | Fog of War | Game Stats Kit

    Comment


      #3
      hm... it is replicated but it doesnt seem to work

      i have a print string to show the player's health, but it only pops when the server shoots the client, not vise versa.

      Does the client perhaps need to ask the server to inflict damage or should that not be a problem?

      Comment


        #4
        Hmmm can't see where might be the problem without seeing your nodes.
        Twitter | Multiplayer TopDown Survival Kit | Fog of War | Game Stats Kit

        Comment


          #5
          Click image for larger version

Name:	4dfdabfc2a3d69f2e2a4c1127e0c470a.png
Views:	1
Size:	190.8 KB
ID:	1118162
          Click image for larger version

Name:	cb388f85ba73adb7d52de0961a348b8a.png
Views:	1
Size:	108.5 KB
ID:	1118163
          Click image for larger version

Name:	cd621ab36b21c1f9d56ebcc08bbef3bd.png
Views:	1
Size:	129.5 KB
ID:	1118164

          let me know if this isnt enough info or if i'm just completely clueless LOL

          but yeah,
          the server can damage the client, but client can't damage server. let me know what you think.

          the pics kinda seem to be backwards btw

          Comment


            #6
            I'm confused by the SwitchHasAuthority node in StartFire. StartFire is only be called within Server_StartFire? If so, SwitchHasAuthority will never execute the remote part. And even if not, this looks a little strange to me. I don't know if you intend what's happening there.

            Anyway, this isn't your problem I think. Can you show what you've plugged into Start and End of your trace? Are you using nodes like GetPlayerController or GetPlayerCharacter there? If so, I think I know why this is not working as intended. Those would always return the server's Character / Controller. That would explain your problem.
            Twitter | Multiplayer TopDown Survival Kit | Fog of War | Game Stats Kit

            Comment


              #7
              yeah im not sure about the authority thing either tbh, i basically followed a tutorial series to get the basic layout of the game, then i added what i needed for an online game (main menu and find/host game) and such, so a lot of stuff in here is not mine really. but here is the entire trace graph. Thank you for helping by the way! would it be a problem if the 2 players are using the same character BP? i would assume not since everything but damage has worked so far. Anyways here's the stuff and thanks again!
              Click image for larger version

Name:	1.png
Views:	1
Size:	222.0 KB
ID:	1118174
              Click image for larger version

Name:	2.png
Views:	1
Size:	216.3 KB
ID:	1118175

              Comment


                #8
                To be honest, I'm a little clueless, too. How are you setting your OwningPawn variable? You don't set it with a GetPlayerCharacter node within a RunOnServer event, do you?
                Twitter | Multiplayer TopDown Survival Kit | Fog of War | Game Stats Kit

                Comment


                  #9
                  this is what i have for set owning pawn
                  Click image for larger version

Name:	op.png
Views:	1
Size:	73.7 KB
ID:	1118177
                  i must have followed the wrong tutorial if even you are clueless haha! but yeah like i said, everything works great so far besides a client damaging the server so i'm not sure what's up

                  Comment


                    #10
                    this is where that function is used, it's in my character BP for giving default weapons

                    Comment


                      #11
                      Your Set Owning Pawn function looks familiar... I think I have seen this tutorial as well.

                      Comment


                        #12
                        haha any idea what i should do? i posted my question in a facebook group and they said instead of using Apply Damage, make my own damage event.

                        Comment

                        Working...
                        X