How to make a "select a grid on map from a given range" function?

So I need a function that some skill and item allow the player to teleport to a near place (like an available place in 5*5 region)/ jump to a custom direction/ blast a fireball in an enemy on the map. You are given several available grids(like a 5*5 square in the teleport example), and you can use the arrow key (better if you can also do it with the mouse) to select one in them.

You may imagine that like what is in an SRPG game, selecting a grid from a given range (I tried to look into the SRPG game but the logic inside does not work here)

I had written that kind of function in RMXP and RMVA in the script by the module while structure, yet RMMV has no graphics. update and the game simply stuck if I imitate that. I also have thought of doing it by events but it seems to be nearly impossible to smooth the animation of the cursor with its movement at the same time. Does anyone have an idea how to do that or seen some similar plugins before?

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-a-select-a-grid-on-map-from-a-given-range-function.133680/