LeTBS find range between caster and target

Sorry if I am posting this in the wrong area. I am new to using forums. So what I am trying to do it make a skill for a ranged attack. The scope will be up to 6 spaces in a circle. Once a target is selected I want the distance between actor and target to be saved as a variable. Then my damage formula to decide if it can hit 2/3/4/5 or 6 spaces away. If the formula says I can hit 5 spaces and the target is 4 spaces then it hits. But if it says I can hit up to 2 spaces then it misses. So basically, I need a way for the skill to determine how many spaces away the target is and turn that into a variable. Thank you so much for any help!
'General Discussion' is for looking at broad themes that affect the making of games in general. "How do I...?" (implementation) questions go in the Support forum for the engine you are using.

Moved to: RPG Maker MV

Original thread: https://forums.rpgmakerweb.com/threads/letbs-find-range-between-caster-and-target.112974/