casting/messaging to other blueprints specified in "open" variables?

I’m trying to make a system that can dynamically turn on and off clusters of lights and objects to simulate domotica.
However after making a button panel i thought about sending messages or casting to clusters/arrays of objects previously linked to in the open variables of the construction script.

This way i don’t have to make 20 different blueprints for 20 different rooms, the idea is to just have a controlpanel with a few buttons that can be linked to lights/appliances specified during the level creation, from a dropdown or with the eyedropper or something similar.
All of the blueprints i want to send signals to already have the nodes in place to let them perform the actions, so currently the problem is with sending them a message.

You can use event delegates for this. Make a master blueprint that will accept a delegate message and derive these other blueprints from that so they will all accept this message. Then call the delegate from an event dispatcher on some other blueprint and they will all respond to the event.

To be more specific:

  1. Create an event dispatcher (located on the same toolbar where you create new variables or functions) on your PlayerController or whatever blueprint you want to send the message. You can add parameters as well so that individual blueprints can act only if the string passed through the event delegate is a certain value, for example.
  2. Create a new blueprint that, on Event Begin Play, will execute the “Assign {Delegate}” node, {Delegate} being the name of your event dispatcher. It will create a custom event attached to the red square coming out of the left side of the node and will pass through whatever parameters you put on your Event Dispatcher. You have to use this specific event because it has the correct signature for the delegate. This just means that other custom events can’t be bound to this event dispatcher, only this specific one. It’s a security thing.
  3. Now when you call your delegate from that other blueprint, any blueprint that is assigned to that delegate will run the logic executed by the custom event. Call it by searching for “Call {Delegate},” {Delegate} being the name of your event dispatcher.

Hi Jared,

I just tried to setup the event dispatcher method,
However after i set up a dispatcher in my “button panel” blueprint i cant seem to create the dispatch event in my “appliance blueprint”.

Is there something i missed?

Here is my Game Mode blueprint with a dispatcher set up called “CustomBeginPlay.” It’s meant to initialize other blueprints after the Game Mode has gone through all of its own initialization steps.

I call CustomBeginPlay at the end of the Game Mode’s Event Begin Play sequence following a delay node (so that other blueprints that bind to CustomBeginPlay have a chance to get a reference to the Game Mode).

Then in other BPs that I want to bind to CustomBeginPlay, I use their regular Event Begin Play to get a reference to the game mode, cast it, place it into a variable, and bind to CustomBeginPlay.

Then I drag out from the red square on the Bind function and create a new custom event using that (to ensure the same signature) and run the logic I want through it.

Now after all of these objects initialize and get a reference to the Game Mode, the Game Mode runs CustomBeginPlay and all of these other BPs with bindings receive it.

thanks for the help that worked :smiley:

I was messing up with where the “bind” event should be, in the “listener” instead of the broadcaster.
It works like a charm now :wink: