I am trying to make the AI run when they sense the player, I’ve set up the AI Controller to be able to handle sight, and have some basic stuff set up in the behavior tree such as patrolling and chasing the player on sight.
I’m trying now to make the AI run when they see the player, basically I want to make an event to change “Max Walk Speed” in the Character blueprint and ‘call’ or trigger the event in the AI controller blueprint.
I don’t know what to plug in to the “Target” in the event being called. “Get Controlled Pawn” doesn’t seem to go in there. Any advice? Thank you
The above gives you the pawn that triggered it and an instigator (in case you can make noise elsewhere - throw a lure or something). Pawns can’t hear if they can see you, btw. Here’s a crude example:
You need to cast the controlled pawn to the BP class where you defined the event so it goes in the target. Basically you need the same class or a subclass of the BP that defined the event.
Get controlled pawn gives you an APawn object which as far as compiler is concerned does not have the event you defined…