Communication widget to blueprint
I'm trying to use a terminal to control some training targets but after hours trying all I can find online I really can't seem to make it work.
My setup is the following: -A target, with built in script to fall down and raise upon damage/command -A (placeholder) terminal, consisting of just a box and a collision box to determine when player is in range to access it (this here is absolutely not functional but still lets me access the widget) -A widget, displaying atm just three buttons being up (raise the target), down (lower target) and out (exit the terminal).
The player access the terminal by pressing F, which opens the UI. Then the player can press the buttons which will communicate which target to raise/lower (currently only one, for the sake of making this work before applying it to the 20 targets)
My problem comes when I have to communicate from the widget blueprint that the button up or down has been clicked. I know the buttons and event react correctly since I can click exit and the UI does close. I know the communication between the physical terminal and the targets work, as I also made so I can control the target with other keys instead of the UI and it works. The problem really is to pull out of the widget the event that a button has been clicked.
I can't use direct communication because since the widget is not in the map, I can't set which target I want to send the data. Most of the other methods I found are usually between a character and the environment, and as such use the character as target/object, while I don't have any of those. As such I am really lost and have no idea how I am supposed to communicate those very simple bool data.
asked Sep 07 '18 at 09:29 PM in Blueprint Scripting
hmmm odd i just submitted an answer but it doesnt show now.
lets try this again. if i read your question right you have a terminal actor, a target actor, and a widget. i guessing that the widget is being created from the terminals script which makes this a pretty simple issue where you just need to have a reference to the targets in the terminal then pass the info on to the widget when its created.
to do this you will need to create a variable array in your terminal which will store the appropriate targets, then you will need to create a variable thats basically the same thing in your widget. then where you create the widget drag off of the return pin and search for set (insert variable name here) to set the array variable thats in the widget. the last thing is to attach the variable from the terminal to the set node which sets the widgets variable value. i show how this looks in the terminal bp in the picture below.
Follow this question
Once you sign in you will be able to subscribe for any updates here