Restricting wandering enemies

im designing an area that has some wandering enemies, I was wondering If I could somehow block them from leaving it. I know those regions can be used to detect movement so Im gonna start there but I figured it never hurts to ask incase someone else knows a good way to do it.
if you want to avoid regions or tiletags, another way is to check the spot
of the enemy, and check map width x < 10 or map width x> 16
same thing you can do for y, so you can force it back into the block
you specify.

but I can't recall the exact scriptcall to use for it.

may be $dataMap.width() or $gameMap.width() which you can check the console log.
I believe the safer way was $gameMap.width() to use them.

otherwise, regions is the way to go (by scriptcall or plugin).

Original thread: https://forums.rpgmakerweb.com/threads/restricting-wandering-enemies.183878/