How to Setup animator for an AI agent?

I got a zombie model and made a new character with the AI agent set. I tried using an animator I made but all the NPC does is the walking animations without going anywhere. It also can die when shot.
 
You can use the same animator as your player controlled characters use - from the AI's perspective this aspect does not change.
 
Parameter 'AbilityIndex' does not exist.
UnityEngine.Animator:SetInteger(String, Int32)

Parameter 'AbilityIntData' does not exist.
UnityEngine.Animator:SetInteger(String, Int32)

Parameter 'AbilityChange' does not exist.
UnityEngine.Animator:SetTrigger(String)

My attempt to make it walk failed and I'm out of ideas.

All I really need is a script I can add to an NPC that detects the amount of damage from each UCC weapon. I can't get ImpactCallback or ReactingObjects to work without a collider and that makes the NPC flip around randomly for some reason.
 
From those errors you've not setup the required controller parameters. See 2 minutes 11 seconds in on the video I linked to above.

1598429112127.png
 
I made a copy of Demo and removed what I didn't need, replaced the animations with zombie animations and tried to make it walk using this:
Code:
    private void GoWalk()
    {
        anim.SetInteger("AbilityIndex", 6);
        anim.SetInteger("AbilityIntData", 0);
        anim.SetTrigger("AbilityChange");
    }
And I got those errors. What the video at 2:11 shows is how to make a new animation controller.
What do I do to make it do the walk thing?
 
What errors did you get?

Setting animator parameters manually like that is not the recommended way to change an agent's animation state. A better way would be to use Abilities. I would recommend reading this page and/or watching the video it contains to get an idea for how to create a simple custom ability that you can use to trigger animations.

However if what you're trying to achieve is the damage callback as you mentioned in a previous post, that's exactly what the impact callbacks are for - so you should look into why your collider "makes the NPC flip around randomly".
 
OK, I made a blank animator controller and recreated my controller in it. I used my parameters to start animations and ignored all of Opsive's stuff. I got it to work, but the NPC doesn't turn toward the target. It just walks in a straight line. Something in the UCC is preventing this code form working.

Code:
    private void FaceTarget()
    {
        Vector3 direction = (target.position - transform.position).normalized;
        Quaternion lookRotation = Quaternion.LookRotation(new Vector3(direction.x, 0, direction.z));
        transform.rotation = Quaternion.Slerp(transform.rotation, lookRotation, Time.deltaTime * turnSpeed);
    }

Any ideas?
 
Manually setting the character's rotation like this is not how to work within UCC. You'll want to create a new custom ability within which you can override CharacterLocomotion.UpdateRotation to set the rotation manually that way.
 
How would I not stop an NPC from rotating? And please don't point to a page of how to make a new animation for the player when it enters a trigger.
 
In order to rotate the character a custom direction you will need to create a new ability and override UpdateRotation. Take a look at the MoveTowards ability for an example. This ability rotates to a direction specified by the target rotation.

The page/video that Andrew linked to is a great resource for how to get started on creating a custom ability.
 
Top