How to get good AI melee attack patterns

Im working on a combat system in the vein of Dark Souls, and I’m struggling to figure out how to set up some attack patterns for my ai that make them seem at least semi-intelligent. Right now, once he notices the player (I’m using a threat lvl system), he will move into attack range and play an anim montage. I want him to have 3-4 attack types. I suppose I could just randomize between anim montages, but is that how people usually set up AI? I’m thinking there are probably some variable checks and decisions that the AI makes but I’ve never learned anything on the logic behind that so I don’t really know where to start.

Well, distance checking would be one of the first things I would have my AI check. The AI judges the distance between itself and its target and then selects a suitable random attack (throwing something, charging, swinging wide, uppercutting, leg sweeping, etc.) You can also have the AI consider its health status, the health status of its target and environmental conditions if you wish to really get advanced. Should it be relentless in its attack? Perhaps a more cautious approach is in order? Many things that can be considered before, while and after picking a fight.

How would YOU approach the combat if you were the AI? What would you think the AI would do? Then try to program that into its behavior.

For Example: A two ton, acid-spewing dragon would likely charge into combat if someone dared to even cross its path. A two pound, grey fluffy rabbit would probably run. Now if the rabbit suddenly became the dragon (thanks Illusia…), the situation might fare a little differently.

Thanks! Yea I just implemented a distance check for decisions. It’s working decent but still a little simplistic. Thanks for the input and ideas!