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. 

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. alt text

and this is what I build in the widgetBP alt text

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!!

Product Version: UE 4.18
Tags:
lighteg.jpg (60.3 kB)
menueg.jpg (30.4 kB)
more ▼

asked Jan 09 '18 at 12:53 PM in Blueprint Scripting

avatar image

JtothePP
7 2 3 4

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

1 answer: sort voted first

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?

more ▼

answered Jan 09 '18 at 01:12 PM

avatar image

xlar8or
6k 161 129 304

avatar image JtothePP Jan 09 '18 at 01:20 PM

Oh hey, my hero from yesterday! :D

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.

avatar image xlar8or Jan 09 '18 at 01:36 PM

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.

avatar image JtothePP Jan 09 '18 at 02:41 PM

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.

avatar image xlar8or Jan 09 '18 at 02:44 PM

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.

avatar image JtothePP Jan 09 '18 at 03:35 PM

Okay, I think I got this right..alt text

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 Eventalt text

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

lighteg2.jpg (47.5 kB)
menueg2.jpg (76.6 kB)
avatar image xlar8or Jan 09 '18 at 06:12 PM

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.

avatar image JtothePP Jan 09 '18 at 06:31 PM

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

avatar image xlar8or Jan 09 '18 at 06:32 PM

Glad to be helpful :)

(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