Announcement

Collapse
No announcement yet.

How do i set actor hidden in multiplayer?

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

    How do i set actor hidden in multiplayer?

    hi guys im having trouble with my game. and i just wanna do some test. so i created an interaction interface and i want to trigger this by my actor. so far i have no problem set my pawn's actor hidden or anything part of the pawn. however, when i interact with another actor it only works on the server's side. so i did a simple test where the actor gets hidden when interacted by my character. so far only works on the server's side. is there something i miss?

    #2
    RunOnServer events only gets called if the caller is the owner of the Actor. That is what the comment on the Server node means "Reliable Replicated To Server (if owning client)".

    Communication from Client to Server has to happen on something the Client already owns like the PlayerController or Pawn or something else.

    The reason it works on the server is because the server calls RunOnServer events regardless of ownership. If a non owning Client try to call the event it is dropped though and a warning is posted in the log.

    Comment


      #3
      Originally posted by GarnerP57 View Post
      RunOnServer events only gets called if the caller is the owner of the Actor. That is what the comment on the Server node means "Reliable Replicated To Server (if owning client)".

      Communication from Client to Server has to happen on something the Client already owns like the PlayerController or Pawn or something else.

      The reason it works on the server is because the server calls RunOnServer events regardless of ownership. If a non owning Client try to call the event it is dropped though and a warning is posted in the log.
      do you have any suggestions to call on a function on actor for multiplayer? i tried doing linetrace. cast on the actor to destroy or hide it but doesnt work. only server side

      Comment


        #4
        Originally posted by GarnerP57 View Post
        RunOnServer events only gets called if the caller is the owner of the Actor. That is what the comment on the Server node means "Reliable Replicated To Server (if owning client)".

        Communication from Client to Server has to happen on something the Client already owns like the PlayerController or Pawn or something else.

        The reason it works on the server is because the server calls RunOnServer events regardless of ownership. If a non owning Client try to call the event it is dropped though and a warning is posted in the log.

        Comment


          #5
          Here is how the flow could look for a client Pawn to interact with a LightSwitchActor in the Level.
          • Client-Pawn -> Call RunOnServer Interact Event
          • Server-Pawn -> Executes Interact Event (Performs a line trace relative to the Pawn and call Interface_Interaction on the hit LightSwitchActor)
          • Server-LightSwitchActor -> Executes Interface_Interaction and Set a RepNotify Variable bSwitchOn
          • All-LightSwitchActor -> Executes OnRep_bSwitchOn -> if bSwitchOn is true it performs the action of turning a light on.

          Comment


            #6
            If you want to destroy a replicated Actor only the server should call Destroy. The same is true for spawning replicated Actors.

            Comment

            Working...
            X