Get event ID by this event id in radius (circle)

1000060321.jpg


I want to get this event id scan nearby events in radius and store as variable.

If this event scans more than 1 event it should randomized event in a frame

I want my allies to attack the enemy immediately instead of bypassing him and take no action at this moment.
should be around the MV version for radius probably:
JavaScript:
$gameMap.distance($gamePlayer.x, $gamePlayer.y, this._eventId.x, this._eventId.y) < 2

the above check the radius within 2 tiles, but feel free to extend it.
if it throw an error, find out how the distance work in MZ and it should work fine
after that, but I think they should be equal.

Original thread: https://forums.rpgmakerweb.com/threads/get-event-id-by-this-event-id-in-radius-circle.175370/