Move an AI with an "onclicked" button

Hi everybody, I warn I am a noob ^^
Everything is in the title, I created a widget with a button and I would like my AI to follow me when I press it.
I tried it like this :

https://i.imgur.com/Jn9nlrG.png

But it could not be that simple and obviously it does not work. Someone To help me in my learning? :slight_smile:

There is a lot of ways to do that, but here is one:

  • On your character, create a function that makes your AI to follow the character as you want
  • On Widget, reference your character (you may use GetPlayerCharacter or create a var on it and instance when you put the widget on viewport ) and call that function.

Hi, thanks for your reply, I tried to put an AIMoveTo on a function of my character but I can not, I tried with “Follow” also but it did not work (not sure to have done well ). Why can not I use the “AIMoveTo” directly on my widget?

The AIMoveTo requires an AIController to work on it, but also, your pawn needs a movement component to do that. Does your pawn controlled by AI has one?

he dont, but I managed with AIMoveTo using a boolean on the widget … Now my problem is that all my AI (same BP) follow me when I press the button …

can you extrapolate on how you used a boolean on the widget ?