I want to use on button clicked to activate a function.

I have a widget with eight buttons that are supposed to send an integer to a blueprint manager that sends it to an array of actor turrets. This integer will tell the turrets what to look at.

I have my turret blueprint actor here that will take the integer given to it and search an array of targets and get the transform it is supposed to use and set the actor to rotate and face where it is supposed to look.

I have a blueprint interface here that has an integer input


This is where I am at trying to figure out why when i click a button from the widget how to get it activate or preform its look at function in the actor. this right here on begin play or on event overlap with the collider from the manager will result in

all of the turrets looking at the first base. yet no buttons pressed will get them to change their target. they only ever go to the first base.

So how do I get it to wait for me to press a button and then do what it does on event begin play or on component begin overlap, and then do it again when I press a new button? Am I missing the right event to use, are my buttons sending integers to the manager and getting the right number to the turrets?

I’ve asked google AI and gotten far enough to get it to do this much within a BP_Turret Actor and Terminal UI widget.

Later I asked the developer assistant on the unreal engine page and got it to work this far including a BPI_ Rotate Actor, and a BP_Manager.

I added a box collider and a on component begin overlap following this https://www.youtube.com/watch?v=rM1tg6kYgn4 but even still the buttons do not result in the turrets changing.

I have ensured the buttons work by adding breakpoints to them and they are clickable they just do not do what I expect them to do. Change the turrets target based off the number they send.

I saved the AI notes

Hey @MiXDMAT!

This is typical AI confusion. AI is not always good for coding as not only can it do things in a very bloated way, sometimes it’s just straight up wrong.

You should never need to use BOTH an event dispatcher AND a blueprint interface.

In this case I would get rid of the interface completely. The code you have there off of “Event Receive Rotation Int” is good, but as it’s using an interface instead of a dispatcher, get rid of the red node.

Go back to the widget blueprint, and follow these directions. You do not need an extra actor to manage the turrets, just set the turret blueprint up to bind to the event. These instructions are accurate enough, I think, just try to be VERY specific and accurate to these here.

Again, remove the Interface and the manager. It’s just adding confusion, because each one of these things would be doing the same job and in my opinion dispatching from the UI is the most efficient thing to do here! :slight_smile:

Thanks for the Reply @Mind-Brain !

this suggestion is similar to what i started with before adding the manager and the blueprint interface it still just looks at base one on start and doesn’t change when any of the buttons are pressed.

for the create widget actor reference i had an array to all the turrets

So I made it again this time with a UI reference to self the blueprint actor but unless the execute pin comes from the bind event to on Base Selected. They wont even face the number one base. Still none of the buttons work to reface the turrets toward any other base when clicked.

If this is on each turret actor, you are creating a new Terminal UI Widget for EACH one of them. They’re probably overlapping, which is an issue and will likely make it appear normal but not functioning.

The white execution line needs to come from your “CustomEvent_0”. Otherwise the Dispatcher does nothing.

It’s behaving in that way when you bypass it because it’s automatically activating on BeginPlay, with a “0” on the Target Base, giving it the first integer. If you want it to operate by button it HAS TO be set up in this way (the way it is in this picture without corrections)

Try putting a “PrintScreen” node where you want to make sure the signal is reaching, such as after “CustomEvent_0”. Then you can track where the execution line is reaching.

The issue is most likely the creation of the Terminal UI widgets using the turrets. Maybe do this on the player? Or just simply somewhere where they aren’t going to create one per turret?

One way to test this would be to have a single turret. If it works with a single turret then this is the problem. Also can you interact with the Widget at all? Try putting printscreen nodes on the button code so it tells you when a button is pressed!