Event Dispatcher - Widget to Actor

Hi everyone,

what do i need to do, in order to be able to click on a button in a widget , that fires an event in an other Actor Blueprint?
…for example toggle a light.

I tried it with an event dispatcher, but i don´t know what do add to the Bind Event to make it work
What input does the “Target” Pin has to be, and where do I get that from? Everything I tried either doesn´t fit, or produced an error.

and this is what I build in the widgetBP

226473-menueg.jpg

Is that partly correct, or complett rubbish?
Is there a better way?

If you know an answer, please explain it so an idiot can understand, because that´s how i feel right know!

Thank you very much for your help!!

Hey there, when you click the button will it always be for that specific light? Or will it turn on, on the current light you are overlapping?

Oh hey, my hero from yesterday! :smiley:

The Overlap Event is just a placeholder, i forgot to mention that. I have to make a custom event for that, right?! I just want the button of the widget to fire the event, nothing else.

You can create an Event Delegate in the player called Toggle Light (or something like that) and on the light actor on begin play you use Get Player Pawn and cast it to your players type, from there you call Bind Toggle Light and connect it to a custom event you create that toggles the light. On the widget, create a variable called Player of the type of your player and in the Event Construct you do Get Owning Player Pawn and cast it to your players type and save that to Player. On the button’s click event you get the Player variable and do call Toggle Light and that will broadcast the message to all of the actors that are binded.

Thank your for your answer but unfortunately I´m not smart enough to follow your instructions.
How do i create an Event Delegate and how do I know my players type? Also I don´t have an Event Constuct in my widget.

You can see this video for Event Dispatchers. If you don’t have an Event Construct you have to right click and search for it.

Okay, I think I got this right…

And this is what I made in the Widget, but the variable seems to be the wrong type, cause it won´t fit to the Call Event

But I still don´t know what to do with the Event Delegate in the PlayerBP

It’s because the Player type is Actor and it has to be Player, because that is where the delegate exists, so after you change the type, delete that Call toggleLight and drag a wire out of Player and search for call ToggleLight and you should be good to go.

Glad to be helpful :slight_smile:

Thank you some much!!!
You made my day again! I will vote for for the the nobel price in kindness and helpfulness! :smiley: