Set MoveSpeed for AI Character in a BT_Task? running/walking speed change

With a Task, you can get an AI Controller that is assigned to an AI Pawn or Character and using get controlled Pawn. However, as a Character is a class that inherits from Pawn, Pawn itself doesn’t have a CharacterMovementComponent that a Character does have. How then, would one obtain an AI driven Pawn’s maxWalkSpeed from the MovementComponent, which determines how fast they are walking. This is for changing the speed into a run like pattern(which we’ll change using a running animation in the character blueprint too) and vice versa.

For the record, this is for a project where the AI pawn will “run” to a random target point away from the player should they get close, and after they are far away enough and reached the point, they return to walking speed.

Trying to do the same thing. How difficult can it be? Have you found a solution?

Surprisingly very simple. Just get the controlled Pawn of the AIController and get its Movement Component, cast it into a Character Movement Component before you can change its Max Walk Speed.

1 Like

Ah yes, that last cast got me. Thanks a lot!

I took a long time to solve this problem, for several hours, I was inexperienced, thank you very much

can you place a pic up of this please