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"

How can client talk to server?

Okay, so I have a door and 2 players. How can I make it so that if one client press the f key the door opens for both players?

I've managed to make it work for the server; if a player is also the server he can open the door and the other player which is only a client sees the door open. But I can't figure out how can a player that is strickly client can open a door for both players with a keypress.

Thanks in advance for any help.

Product Version: UE 4.10
Tags:
more ▼

asked Feb 05 '16 at 02:12 AM in Using UE4

avatar image

GuillaumeCote
5 1 2 5

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hi GuillaumeCote,

Asuming that you are working on blueprints, and you have a BP_Door blueprint, for example, you need somethings:

Inside your BP_Door: 1 - Create a OnRep_ variable called IsOpen, for example.

2 - Create a Blueprint Function called OpenDoor, for example, with the logic to open the door (using a animation or a Timeline)

3 - Create a RunOnServer Event called ServerOpenDoor, for example, inside this event you will put in true the IsOpen var and call the OpenDoor function.

4 - Now implemement the OnRep_IsOpen function and here just call the OpenDoor function.

So, when the character press the F key, you need to get the reference of the BP_Door and call the ServerOpenDoor Event. Doing this, the server will open the door and replicate to the remote clients the IsOpen var, when IsOpen var is replicated to the remote clients the OnRep_IsOpen is called and the OpenDoor will be called also.

Best regards

more ▼

answered Feb 05 '16 at 02:31 AM

avatar image

nan2cc
502 23 13 38

avatar image nan2cc Feb 05 '16 at 02:34 AM

... ahh one last thing, you need to put in true the Replicate property in your BP_Door to allow BP_Door actor to call RPC functions and replicate vars.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

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

Answers to this question