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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to send message to a specific player from a custom event that only executes on server?

I have a custom event that only executes on server and inside the event I would like to send back the result message to a specific player to be display on his screen. How could I do that?

Product Version: UE 4.12
Tags:
more ▼

asked Jul 26 '16 at 03:35 PM in Blueprint Scripting

avatar image

edwardkoo
43 8 7 11

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

2 answers: sort voted first

Hi there, (sorry expose, had already put this together :/ ) so here we go, this is all you need:

The PlayerController runs on the owning client and on the server. So this is the place to put your replicated Event. So you just need to create the MessageReceived EventDispatcher. alt text Your Widget with the TextBox: The widget just needs to listen for the Shout-out from the PlayerController when a Message arrives, so here we go: alt text

happy to help, Marooney

widget.jpg (67.6 kB)
more ▼

answered Jul 26 '16 at 04:50 PM

avatar image

Marooney
891 36 8 37

avatar image Marooney Jul 27 '16 at 08:54 PM

Just as reminder, since you are new to Answerhub: Please click the accept answer button on the left side of the answer if it has solved your problem. The answer will turn green and the Question is marked as [RESOLVED] for everyone. Thanks :)

avatar image edwardkoo Jul 28 '16 at 10:59 AM

Ok finally got it working. The server event that needs to send message to client was in player character blueprint so I had to pass a player controller reference into the event and call the player controller's message received function. Thank you!

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

well what you can do is to call your event from the player controller and pass a reference on your custome event, so when it runs on server, you can trigger a fuction in your player controler using this reference. hope it's clear enought and that it helps

more ▼

answered Jul 26 '16 at 04:31 PM

avatar image

expose
769 26 5 43

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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