How Do I Call an Event from a Character Blueprint by Clicking a Button on my HUD Widget Blueprint?

First, I am new to all this. Sorry if this has been answered already, but I haven’t been able to find an answer.

I am wanting to move my character between multiple target points by using a custom event and then referencing/calling in the event by pressing a button on the HUD.

  • The event works just fine by itself when I plug it into event begin play. I only run into problems when I try to reference it with the button.
  • I’ve tried casting to the character as well as calling the event. I don’t know which works. Pictures Included.

For the life of me I cannot get this to compile. Is what I am trying to do even possible? Thanks in advance for the help.

Your cast to AI character is not casting to anything, it needs an object input. (What object would you like to cast to).

Casting is like asking an object if it is a certain object or not. If it is, it will succeed, then you can drag off the output of the cast node as that object and call functions that exist on that object.

So your going to need a reference to the object you want to cast to, depending on how you have things setup this can be done in a lot of ways.

Inside your widget, there is a function called “Get Owning Player Pawn” this will give you a reference you can cast to. Then try casting it to your custom AI character to has the function you want to call, then try calling that function.

You also need to make sure that when you create the widget that you provide it with an owning player. (In this case you could use a reference to “self”)

This is fundamental blueprint communication and it is going to be something you have to learn to do almost anything with the engine. I highly recommend this epic tutorial with Zak Parrish on all forms of blueprint communication. It hands down has to be the very best tutorial on this that exists.

This will really help you: Blueprint Communications | Live Training | Unreal Engine - YouTube

1 Like