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"

Multiplayer - Server request client HUD to run function

Working on my multiplayer game (dedicated server), and I ran into some confusion regarding updating my client's HUD from server.

Scenario:

  • I have a buff/debuff system which is all handled server-side, which works perfectly. However, I want to display these buffs to the affected client.

  • When the buff is created and attached to the player, I want the server to call a function from a widget blueprint on the client side.

  • However, I run into the error message that the HUD reference is not found because it doesn't exist in the server's eyes.

How can I call a HUD widget function from a server-only chain of events?

alt text alt text

Product Version: UE 4.15
Tags:
more ▼

asked May 26 '17 at 05:40 AM in Blueprint Scripting

avatar image

fishbone94
49 5 7 9

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

1 answer: sort voted first

The HUD class isn't replicated so only the client who owns that HUD knows of it. This means that if the server side tries to reference something on the client that only the client owns, it will not work.

What you can do is send the data you want to change to a class that is replicated, such as the PlayerController, which is only owned by the server and the owning client; clients can only see their own PlayerController class. The PlayerController is also in charge of creating the client side HUD class so it has a reference. You can use this reference to pass in anything from the PlayerController to the HUD.

more ▼

answered May 30 '17 at 05:01 PM

avatar image

ImVawx ♦♦ STAFF
6.7k 114 17 127

avatar image fishbone94 May 31 '17 at 01:10 AM

To fix my issue, I created a client-only function back in PlayerController that was able to update the HUD as mentioned. The server told the owning PlayerController to update their HUD within the chain of command.

(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