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"

Proper use of Switch Has Authority

Hello, sorry if this is a really silly question to ask, but I've been messing around with the networking part of blueprints and I've somewhat come across a hurdle.

I've been trying to make one of the two characters(either server or client) to attach a weapon they find on the ground. The problem was that every time only the server actually saw either the client or himself equipping the weapon, while the client didn't see anything. After some experimentation I've found that if I want the client to equip the weapon, he has to send a request to the server. Eventually I ended up having to use two different replicated functions, one for sending a request to the server and one for multicasting the change to every other player. Image Here's the first of my two questions, is this a proper way to do things or am I sending unnecessary load to the server?

The second question is, on which function do I need to use Switch Has Authority ? As you can see in the image, I'm currently using on the first one because it only works there.If I try to use a Switch Has Authority on the second function, it acts as if I'm not sending data to the server. Is this how it's supposed to be, or am I not sending data properly?

Product Version: Not Selected
Tags:
switchhas.png (167.0 kB)
more ▼

asked Nov 05 '14 at 04:54 PM in Blueprint Scripting

avatar image

Wisk
30 4 7 11

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

1 answer: sort voted first

Switch has authority just tests if the player is the client or the server.

So everything behind "Authority" only gets called if it's called on the server and everything behind "Remote" gets called if a client uses it. I guess the server itself counts as a client too :X.

If you have a replicated variable, that holds your weapon, you can make a custom event that is called by client and only runs on server (so behind the red node you put the Switch node and take the Authority). If the client knows what he picked up, you could pass the weapon by the custom event inputs and fill the variable with it. If the variable is replicated, you don't need the multicast i think. This is what you already did i guess?

I don't know if your variable is set to replicate, so you could try changing this and removing the multicast. If it doesn't work, then i'm wrong, sorry. (: But at least give it a try. If you current setup works completely fine, i guess you can stick to it.

The best thing to learn the networking system is to watch the networking videos on Youtube, made by Epic. They teach you how to replicate things to other players and much more.

Most of the time i have a twist i my head too, thinking about the networking RPCs.

more ▼

answered Nov 05 '14 at 06:26 PM

avatar image

eXi
6.8k 333 185 470

(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