x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[Closed] Switch has authority to call for remote machines and not for the proprietary client

I'm trying to make an event inside the character be called on the server by the proprietary client but I don't want the event to be seen by me, only by the other players.(Set World Rotation) Help?

alt text

Product Version: UE 4.21
Tags:
image.jpg (135.9 kB)
more ▼

asked Jan 08 '19 at 09:25 PM in Blueprint Scripting

avatar image

TheSubZer0
114 8 13 17

avatar image TheSubZer0 Jan 08 '19 at 09:33 PM

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

The question has been closed Mar 08 '19 at 11:28 PM by TheSubZer0 for the following reason:

The question is answered, right answer was accepted


1 answer: sort voted first

You can use PlayerState.PlayerID to pass it on server RPC then from server multicast it to clients passing the same PlayerID. Inside the multicast event, check the PlayerID and don't perform if the PlayerID is the same with the receiver's PlayerState.PlayerID.

UPDATE: Here's an example:

Here's what I would do:

  1. Remove the SwitchHasAuthority node you have in the image.

  2. Remove the MulticastTick event

  3. Check Replicates on your Actor

  4. Uncheck ReplicateMovement on your ArrowComponent

  5. Just call the Server event passing the Rotation params and it will happen to everyone

Now if you don't want that to happen on the proprietary client, just do what I said above about using PlayerState.PlayerID.

Here's what I did on mine:

  1. Add GetState (PlayerState) function in my PlayerController alt text

  2. Add GetPlayerID function in my PlayerController alt text

  3. Add IsCurrentPlayer function in my PlayerController alt text

  4. I used all of the above in my other Actor to only play sound on the proprietary client and not on other clients and server. You can do the same but use the False to make it happen to every server and clients but NOT on the proprietary client. NOTE: I forgot to set the event to Run on Server event but it should have been to replicate it to everyone and then filter out which client should run it and which should not. alt text

Addendum:

To use that on your events, just add the PlayerController input on your TickOnServer event and add the IsCurrentPlayer checks so you can make it run on every clients but not on the proprietary client (the one that passed his PlayerController).

Now that you know how to do it the hard way, here's the magic way of doing it:

  1. Pass the Client's PlayerController that called the event via ServerRPC. Inside the event, drag the connector from the passed PlayerController input and then use the IsLocalController or IsLocalPlayerController node. True means that the current player evaluating the event is the same as the one who called it via Server RPC call. alt text

more ▼

answered Jan 28 '19 at 05:07 PM

avatar image

Chyros
1.2k 8 4 8

avatar image TheSubZer0 Jan 28 '19 at 05:11 PM

Yes, but the problem is that when I call the event remotely, it can also be seen in the proprietary client, because the object has its motion replicated, even restricting the event to be called in the specific id player, it is as if the other machines were calling the motion update event back to the proprietary client.

avatar image Chyros Jan 28 '19 at 05:18 PM

Disable the ReplicateMovement property on the object so that the server wont override the proprietary client's movement or rotation.

avatar image TheSubZer0 Jan 29 '19 at 03:41 PM

If I disable movement replication, nothing happens, the event is not called, not even to the client.

avatar image Chyros Jan 30 '19 at 12:36 AM

I have updated my answer above. Please see if it works on you.

avatar image TheSubZer0 Jan 28 '19 at 05:13 PM

(that's the engine that does it)

avatar image TheSubZer0 Jan 28 '19 at 06:14 PM

nothing has changed :(

avatar image TheSubZer0 Jan 30 '19 at 06:50 PM

Thanks!, worked.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question