Compare distance between two characters? AI dodging help

So I want to try make an AI character dodge my melee attacks.

I’m thinking that if my thirdpersoncharacter gets within a certain range, and when I press my attack input, my AI character will have a certain % chance to move 300 (for example) units backwards/left/right

How exactly do I go about doing this? I’m new to blueprinting but had about a couple days practise with it.

I’d put a sphere collider of a specific size (for the range) around your player character. Then on overlap, check the other actor by casting, and if it’s the AI actor you want, run a custom event on the other actor that decides whether or not to dodge.