Check if an event is surrounded by other events

Hi, makers,


I want to check if an event is completely surrounded by other events via conditional branch (with script). Is there a way to do this? I want to make an event that jumps out when is surrounded by other events and can't move.


Thanks in advance
 Define surrounded, Just the 4 directions or the 8 directions?
 Define surrounded, Just the 4 directions or the 8 directions?

I mean 4 directions, but if you can give me also code stuff for checking the 8 directions I'll be even more pleased.

Original thread: https://forums.rpgmakerweb.com/threads/check-if-an-event-is-surrounded-by-other-events.73871/