Making mobs Smarter

Hello, I am working on a rpg game, and I need some help on making Mobs smarter, such as dodging, blocking, how is this done?

This would be done in such a way that the attacker sends a message to the receiver that represents “I’m attacking”. The receiver chooses a random action to do, and does it. All entirely scripted.

Yeah thats what I was thinking thanks