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"

Switch Has Authority Returning Authority For Client

Hello,

I set up a simple blueprint that should print "auth" or "rem" depending on the result of a Switch Has Authority call, and it is printing "auth" even on client side... I am testing this using the in-editor network simulation.

Blueprint and results below. Any ideas as to why this might happen?

alt text

alt text

Product Version: Not Selected
Tags:
authority1.jpg (169.4 kB)
authority2.jpg (379.2 kB)
more ▼

asked Feb 17 '15 at 11:28 PM in Blueprint Scripting

avatar image

Parrot Wing
16 1 2 1

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

1 answer: sort voted first

Hi Parrot Wing,

This will depend on how you're spawning your HUD. Authority is a per-actor concept - if it's spawned on the client, that client will be considered the authority over that actor (note clients can't replicate entire actors to the server). If it's spawned on the server and set to replicate, when the client checks "Has Authority" for that actor, it should return remote.

Depending on what you're trying to do, you may be able to achieve the desired effect by calling "Is Local Player Controller" on the associated player controller instead.

There is a known bug, which should be fixed in 4.8, where player controllers were reporting incorrect authority during the "Begin Play" event. I'm not sure this is what you're seeing since it doesn't look like you're checking in a player controller blueprint, but in case it is, doing the authority check in the "Post Login" event of the game mode is a potential workaround. Note this event is only called on the server, so you may need to call your own replicated event from here to perform logic on the client.

more ▼

answered Feb 18 '15 at 01:22 AM

avatar image

Ryan Gerleve STAFF
1.1k 25 12 49

avatar image Parrot Wing Feb 18 '15 at 01:46 AM

Oh, that explains why it isn't working. I'm trying to make different menus appear depending on whether the game is currently a server or client. I tried "Is Local Player Controller" but it's returning true for both server and client. Is there a different way to check whether the HUD is on a server or client instance?

avatar image Ryan Gerleve STAFF Feb 18 '15 at 03:27 AM

The easiest solution is probably to do the authority check on the player controller or character/pawn, then forward the result via an event or function to the object that was spawned on the client (in this case the HUD).

avatar image Parrot Wing Feb 19 '15 at 06:02 PM

Ryan,

Thanks for the suggestions! I was able to achieve the desired effect using the "Is Server" function, which I just found.

(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