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"

How to use a 3D widget component to affect the level blueprint?

Hi All,

I'm trying to make an interactive computer screen element in my game, and I've used 3D widgets to act as the terminal displays. The problem I have is - how do I get button events in the widget blueprint to affect the level? I want the player to be able to press a button whilst possessing the terminal, and have it turn on a light. I basically just want to get the widget button to affect the level blueprint.

alt text

Here is what I have so far. I have a Pawn Blueprint called 'Terminal.' This has the model of the terminal in it with the widget component attached to the screen. The player possesses this pawn to use the terminal's controls and the widget.

alt text

The widget blueprint used by the above widget component is called 'Interface', Button events originate here, but I can't seem to get them to affect the level, because they are not technically in the level, they are components of the 'Terminal' pawn blueprint class.

alt text

Finally, I have the level blueprint, where the functions for turning the lights on and off are. The 'Get' variable I created to point to the widget component is empty, because it can't be selected in the level (because it's contained in the Terminal BP)

alt text

I'm sure the solution is probably very simple, but I am very new to BP scripting, so any help figuring this out would be greatly appreciated!

Thanks

Product Version: UE 4.13
Tags:
help1.jpg (265.8 kB)
help2.png (345.6 kB)
help3.jpg (104.3 kB)
help4.jpg (306.8 kB)
more ▼

asked Oct 14 '16 at 06:10 PM in Blueprint Scripting

avatar image

ollyryder
3 2 3 5

avatar image ollyryder Oct 15 '16 at 01:07 AM

sorry, but - bump

avatar image MetricZero Nov 13 '16 at 06:23 PM

Hey there, did you ever find an answer to this? I'm having the same issue.

avatar image ollyryder Nov 15 '16 at 03:55 AM

Hi, I did manage to do this eventually.

The only way I found that worked was to use 'Blueprint Interface' blueprints. I made an interface called 'ButtonPressed' or something, Then I had to go into the class settings of the widget bp and the target blueprint and add the interface to the blueprint (it's under class settings -> interfaces, then click 'add' and choose from a list). Once I had done that, I created an interface message node coming off the button click in my widget event graph. A message node basically calls out events to a target blueprint every time it is called. The only problem with this was that I couldn't target the level blueprint directly. So I made my light its own blueprint actor class. Then all I had to do to target the light from my widget blueprint was 'getallactors of class', select my light blueprint from the dropdown and break that with a 'for each loop' node. Then you can drag off the reference from the array element node, and plug that into the message. Lastly, you just have to go to the 'light' blueprint, and (make sure you've added the interface in class settings) do 'event on ButtonPressed' (or whatever you called the interface) then toggle visibilty/change color etc like you would do any other event.

One final thing. If you want to pass variables between the widget bp and something else it is painful, but possible. I won't go into it now but if you need to know how to do that just ask.

I hope that answers your question. It was a right headache to figure this all out since there is pretty much nothing out there on making interactive widgets for computer terminals and such haha! I might have to make a video tutorial or something on how to do it.

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

1 answer: sort voted first

Hi Ollyryder,

I would recommend you use the Event Dispatchers to handle this.

As a quick test I created an event dispatcher in the pawn. Then in the level I can call it, or vice versa.

The trick may be in locating your pawn object reference from the level blueprint. You can either use the editor and place a fixed reference, or do a lookup on the scene.

more ▼

answered Oct 15 '16 at 01:22 AM

avatar image

learningOver
159 3 3 9

avatar image Night Watcher Oct 15 '16 at 04:58 AM

Here is a video that explain how blueprint communicate with other items in the scene, including event dispatchers, I would highly recommend you watch it:

https://www.youtube.com/watch?v=EM_HYqQdToE

(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