How do I set up a simple AI on a character bp set up to use the enhanced input system?

I’m just trying to set up a simple dummy AI that spams an attack.
The dummy is the same character bp that my player is and right now it is set up to receive input action events that trigger actions like attack, move, and dodge.

I have not seen a way to spoof inputs by calling the input action events like you could a custom event to fire the code. I thought I could just slap on a simple Ai Controller and have it call these events but I cant find a way.

How do I achieve this? Do I need to rework the character BP in some way to accommodate an AI controller?

I’m still new to UE so I’m also unsure where the logic is intended to go but as of now most of it is on that Character BP, with some in components attached to the character.

So as of now my solution is to set up custom events for every action the character can take (move, dodge, attack, etc…). This way the controllers can call these events from their BPs allowing AI to control the character without Input Actions.

This just feels odd to me, having to bridge this functionality by having events call events. It also feels clunky since I now effectively need to create multiple events for a single action in some cases (trigger, complete), and have to make new custom events if I add new controls with the Enhanced Input System even though those events are already there. It would be great if we could just call those input events in script instead of them only working from actual user input.

If I wanted to do something like this I would give the character blueprint an interface and use the player controller to handle all inputs and send the interface calls to the character. This way the AiController could communicate with it’s pawn in the same way using the interface calls and only the player controller needs a mapping context or player specific things like pause and menus. Alternatively you could have the input actions lead directly into functions, and then call the functions from the AI controller instead of trying to call the input actions. I would use interfaces though cause having input actions and a mapping context on an AI character seems wrong to me.

1 Like

If you used a non-pawn actor, it would just work after enabling input. Pawns have their own rules which I believe stem from possession - only the possessed pawn processes input.

a way to spoof inputs by calling the input action events like you could a custom event to fire the code

It’s this:

However, afaik, there is no way way to target an actor since that’s not how input processing works at all.

Thats pretty much the conclusion I came to as well. It just seemed like the input system could almost act as that interface as well since the input nodes appear to be events.