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. 

Variable from client doesn't replicate to the server

Hi,

I'm trying to set a boolean to true from a client to the server, however the server keeps seeing it as false (OnComponentBeginOverlap prints 'false' when I called Capture with a client, and run in the Sphere as the server). The C_Capture Capture event is called when the player presses a key. The CaptureSphere can be seen as a sphere in the level in which the player needs to stand to be able to call the Capture event.

When a player has called the capture event, the CaptureSphere should notice that someone is capturing it and no other player should be allowed to capture it at that moment.

What am I missing?

alt text alt text

Product Version: Not Selected
Tags:
c_capture.png (233.6 kB)
capturesphere.png (94.2 kB)
more ▼

asked Dec 08 '14 at 10:02 PM in Blueprint Scripting

avatar image

stefanorie
23 2 5 7

avatar image Nanoxin Dec 08 '14 at 10:14 PM

Hey, sadly I'm absolutely bad in Blueprints, but let's try with my c++ knowledge :) : After the input event you check if executing machine has authority but that can never happen, as the server doesn't receive inputs, so if a machine triggers that event it's definitely a remote client (or a listen server, but yeah, then it'll only work for that specific person). You'd need some sort of server function (I do not know how this is handled in Blueprints) to notify the server about what happened and then do all the stuff after the HasAuthority-Switch. I hope this helped a bit :)

avatar image stefanorie Dec 08 '14 at 10:20 PM

Hm however if I try to test that I am Authority I get a different result. As you can see in the screenshots I fired the event while playing in the client window. alt text alt text

serverprint.png (131.9 kB)
serverprinttest.png (724.1 kB)
avatar image Nanoxin Dec 08 '14 at 10:29 PM

Okay, looks like I didn't read the question carefully enough... However I do not really understand what exactly the problem is? What part doesn't work? (However I'm still confused that the input is somehow also done on the server?)

avatar image stefanorie Dec 08 '14 at 10:36 PM

Well I'm trying to set a boolean to true, while being the client, however the server still sees it as false. I've stuffed all my code in the PlayerPawn class directly now, and all the sudden it works... I don't understand why it only works directly in the player class...

avatar image Nanoxin Dec 09 '14 at 12:21 AM

Well it's pretty late over here, so I hope what I write makes some sense at least, BUT re-reading all that stuff (especially the title) I think there's some degree of mis-understanding as replicating works only from the server->client as the Server is always the authorative instance in your game (you can change that to some degree, but in general ...)

To change variables on the server you have to use the server-functions. However, I don't exactly know why it works now that you just moved the code ... ? I hope someone with Blueprint-knowledge can give some deeper insight and help here :)

avatar image stefanorie Dec 09 '14 at 10:40 AM

It seems that I can only do thing as the 'player' when I add the logics to the 'player class'. But I need to know how I can set stuff for the player in different blueprints, I thought I got this working earlier, but all of the sudden the clients are not able to do the stuff the server is able to do.

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

0 answers: sort voted first
Be the first one to answer this question
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