

This common event (triggered by a parallel process) checks if a baby racoon (events 2 through 6) is 1 tile away from the witch (event 7). If true, the baby racoon follows the witch UNLESS the player is 2 or less tiles away from the baby racoon. The conditional branch code goes off the edge of the screenshot, the first nested pair read like this:
($game_map.events[2].x - $game_map.events[7].x).abs + ($game_map.events[2].y - $game_map.events[7].y).abs == 1
($game_player.x - $game_map.events[2].x).abs + ($game_player.y - $game_map.events[2].y).abs <= 2
And then that's repeated all the way down the event with the [2] increasing to repeat the logic for each racoon baby.
So, my question is, can I just have one bit of code that checks this for any baby racoon and any enemy, rather than having to make a separate condition for every single combination of baby racoon and enemy?
I hope I explained that okay. Thanks for reading!