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"

How would you recreate a light switch and light in Blueprints?

Newbie here, thank you for your patience.

I've watched the official Blueprint tutorials covering enabling/disabling/handling input, having blueprints communicate to each other via custom events and event dispatchers, and networking (variable and function replication).

I've tried to combine it all to make a [conceptually] simple light switch blueprint and lamp blueprint that communicate to each other (light switch sends a boolean to lamp light that sets visiblility), and also works in a client/server multiplayer environment.

The light switch and lamp work fine in single-player, but multiplayer is only halfway working - The server can switch the light on and off just fine, and it even shows in the client, but the client doesn't want to switch on that lamp.

My blueprints are extremely messy from inserting Print nodes all over to try and figure out where the breakdown is, so forgive me for leaving those out for now; I will post them tomorrow after work, and after I've cleaned them up to be more viewable/readable.

Here are some screenshots of the behavior I've got working so far:

alt text [Light Off]

alt text [Server Toggles Light On - Replicated to Client Succesfully]

If I try to use the Client to toggle that light switch, nothing happens.

So, what would you do to get a Client to communicate properly to the Server, telling it "I am toggling this light switch's boolean, so you need to change the boolean in that lamp to match, which would turn on that light source"

I'm probably way over-thinking this, and/or I'm missing a proper setting of Run on Server/Run on Owning Client/Multicast.

How would you go about making an interactable light switch blueprint and lamp blueprint work as expected and sync across server and clients?

Thanks in advance!

Product Version: Not Selected
more ▼

asked Jun 04 '14 at 05:49 AM in Blueprint Scripting

avatar image

3 1 2 4

avatar image FaceToKeyboard Jun 04 '14 at 03:16 PM

UPDATE: Some research leads me to think that I need to make the client "own" the light switch in order to make sure the RPC event in the light switch blueprint is functional, or perhaps make the player's character be the one to send out an RPC instead of the light switch itself. Will try more things after work.

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

3 answers: sort voted first

You was right. I found the solution here: https://answers.unrealengine.com/questions/74932/blueprint-rpc-for-non-owner.html

Now it works fine. =D Thank you very much.

more ▼

answered Apr 07 '15 at 11:16 PM

avatar image

31 1 2 3

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

Hey FaceToKeyboard,

Without seeing your blueprint setups, it's a little difficult to help pinpoint what may be going on--if you wanted to dig in a little more yourself more before posting your blueprint screenshots, take a look at this post from the forums: https://forums.unrealengine.com/showthread.php?2956-New-Blueprint-Networking-Tutorial-Videos-Posted

That has a list of blueprint networking tutorials that may offer some insight into your issue. We don't have the maps he's using the in the tutorials available publicly just yet, so if you are still having trouble getting this working just reply back with your blueprint screenshots and we'll be glad to take a look with you.



more ▼

answered Jun 04 '14 at 11:46 PM

avatar image

Steve Allison STAFF
4.3k 123 58 209

avatar image FaceToKeyboard Jun 05 '14 at 03:39 AM

I've cleaned up my relevant blueprints and boiled them down to the core of how I'm trying to get things working.

Here are the screenshots of my light switch, lamp, and level blueprints.

alt text

alt text

The Set with Notify function for the boolean simply toggles the light on and off.

When using the Server player, the light visibility does properly replicate to the client.

The light visibility toggle does not work when using the client.

I appreciate the help!

light switch.jpg (98.5 kB)
lamp and level.jpg (129.4 kB)
avatar image Jonathan Dorman STAFF Oct 22 '14 at 03:28 PM

Hey FaceToKeyboard,

I'm just checking in to make sure this issue was resolved. Are you still having trouble with it?

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

Hello i also have the same problem. Since no one have posted the solution i want to reopen this cuestion. Thank you very much.

more ▼

answered Apr 06 '15 at 10:11 PM

avatar image

31 1 2 3

avatar image monovdd Apr 06 '15 at 10:22 PM

After few researching i found that this must be releated to the owner. The light is owned by the server so the client dont replicates over the network. But I really donde know how resolve this.

avatar image FaceToKeyboard Apr 07 '15 at 12:19 AM

Hello monovdd,

What is important to know is that the requests to the server can only be made by the owner, so having function replication in the light switch actor or the lamp actor is incorrect - actors in the level are owned by the server.

What you need to do is make a request to the server using either the pawn that is possessed by the client, or the client's player controller. Wherever you create your replicated Custom Event/function, you need to call it from that pawn or player controller.

Hope this helps!

avatar image monovdd Apr 07 '15 at 08:33 AM

Could you make an example? Im really lost with this issue.

avatar image monovdd Apr 07 '15 at 09:10 AM

This is what i have on the Blueprint of the character where all other function like movement of the character occur.

alt text

I call form that first function with a blueprint interface another function on the swith light blueprint

alt text

And then I use the variable On Rep for turning the light on.

alt text

The result is that the client can turn the light but the effect is no trasmited over the network only when the server turn the light on the effect is trasmited over the net.

I really need your help to understand those localization issues. Im really newie with this engine.

1.jpg (519.0 kB)
3.jpg (383.2 kB)
3.jpg (383.2 kB)
avatar image FaceToKeyboard Apr 07 '15 at 03:01 PM

I am at work at the moment, so I will be able to upload an example once I'm home.

For now, I will say that you are very close, but have the Call Interface -> Server Call backwards: It should be Server Call -> Call Interface.

In your Blueprint of your Character, you should call a Run On Server event, such as "Rama (Verdadero)" -> "Call Inteface (Run on Server)"

then, also in your Character Blueprint,

"Custom Event: Call Interface (Run on Server)" -> "Oninteraction User"

This way, the character will make the call to the server, then the server will call the interface, which will allow the event to fire on all clients.

Hope this helps; I will help again at home if you are still having trouble.

avatar image monovdd Apr 07 '15 at 07:42 PM

I'm pretty lost right now hahahaha. If you could show me an example.. you will help me so much. I did what you told me with the custom event but it didnt work... I sure that im doing someting wrong.

(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