I'm trying to make a guard who chases the player. I got the part where the guard is moving to the player (which is really easy to do), but due to no idea how to achieve the player getting caught, I tried scripting it.
This is my script, but something is wrong with it.:
(Never tried scripting before)
if GuardX == (PlayerX - 1) or if GuardX == (PlayerX + 1) or if GuardY == (PlayerY - 1) or if (GuardY == PlayerY +1) then $game_self_switches[[14, 1, 'B']] = trueHere is the full event page:

What's wrong with my script? Or is there a much easier way to achieve this?