As the title suggests, I am trying to change the animation of a set of crowd agents while they are moving between destinations.
The agents I use have the AT_CH_Human AnimTree. I tried to change the animation through Play Agent Animation. I populated the action's animation list only with CC_Human_Male_Idle. However, when this Kismet action is reached, the agents' animations don't change. I have checked my Kismet sequence and it works properly when I remove the Play Agent Animation action.
I read that one can play a custom animation through unreal script so I put a custom animation node in the AT_CH_Human AnimTree and tried to play it on every Tick. That's how I did it (the code is from my custom MobileCrowdAgent class):
simulated event Tick(float DeltaTime)
{
Super.Tick(DeltaTime);
if(AnimNodePlayCustomAnim == None)
{
return;
}
if(!AnimNodePlayCustomAnim.bIsPlayingCustomAnim)
{
AnimNodePlayCustomAnim.PlayCustomAnim
('Stun', 1.0f, 0.1f, 0.1f, false, true); // 'Stun' is the Node Name
}
}
And here's where I've added the custom animation:

Still, I had no success with playing even that custom animation so I tried another thing. Specificaly, I overrided the OnPlayAgentAnimation function and made it stop the agent, stop its behavior and play the custom animation. Finally, I came up with this (which is also part of my custom MobileCrowdAgent class):
simulated function OnPlayAgentAnimation(SeqAct_PlayAgentAnimation Action)
{
GetALocalPlayerController().ClientMessage("On Play Agent Animation");
StopBehavior();
Action.SetCurrentAnimationActionFor(self);
Velocity = vect(0, 0, 0);
AnimNodePlayCustomAnim.PlayCustomAnim('Stun', 1.0f, 0.1f, 0.1f, false, true);
}
That also didn't solve the problem. It didn't even stop the crowd agents. They just continued with their current behavior.
The crowd agents are being spawned from four radially placed GameCrowdAgentDestinations and they're trying to reach a destination at the center of the map. They should change their animation, on a button press, to an idle one and stand still. I am developing for a mobile device.
What can be a possible solution for this issue?