Range System and Range-Based Attacks

Hello guys, i am pretty new here and i wanted to ask about a range system.
First, sorry for my bad english, so let's start.

Is there a way of doing a range system? Like... My project have 2 types of abilities for the player to choose, one is physical and the other shoots projectiles. I wanted to do 3 ranges :

S = Short Distance from MC , takes a lot of damage to physical attacks.
M = Medium Distance from MC, takes less damage to physical, but still vulnerable.
L = Long Distance from MC, can only take damage from projectiles.

My question is : How do i make the enemy change distance mid fight and get immune to short range attacks in a certain range?
Look at Yanfly's Rows Formation plugin, it allows you to set up exactly the kind of system you're talking about.

Original thread: https://forums.rpgmakerweb.com/threads/range-system-and-range-based-attacks.148072/