RPG Maker MZ Script to check event overlap

Hello,

How can I check whether one event coincides with another?
In another thread there was the following script: $game_map.events[3].x == $game_map.events[8].x und $game_map.events[3].y == $game_map.events[8].y
The script doesn't work for me.

I hope someone can help me.

Thanks!
You don't need code for this. You can use the built-in Control Variables event command to get the X or Y location of any events on the map. Then Conditional Branch sees if they're the same.
I know that, but it's more cumbersome. I have now figured out the appropriate code.

The code is: $gameMap.event(4).x == $gameMap.event(24).x && $gameMap.event(4).y == $gameMap.event(24).y;

But now it would also be good to know how I can check if an event is in the same position as a Map Terrain.

I tried the following: $gameMap.event(30).x == $gameMap.terrainTag(1).x && $gameMap.event(30).y == $gameMap.terrainTag(1).y;

That dosnt work

I think with the script it is easier to work. Maybe you know how I can solve this problem?

I would be really grateful if someone can help me. I just can't do it
Are you just making up code instead of looking up the correct syntax? Try
Code:
$gameMap.terrainTag($gameMap.event(30).x,$gameMap.event(30).y)==1
Thank you so much! It works!

Original thread: https://forums.rpgmakerweb.com/threads/rpg-maker-mz-script-to-check-event-overlap.171032/