(not so) Main Events! [RPG Maker] - GUARDS!
GUARDS ON PATROL!
I hope this helps those who will want to do something like this for their games.
Okay, so you want to have guards on patrol in a certain map, but don’t feel like trying to find a script/plugin to do it? Well, fear not! Here is all you need to accomplish what you need with eventing!
Required:
1. 4 separate variables (Direction, event’s X, Y and player’s X, Y)
2. Nested Conditional Branches (to handle all the processing)
Okay, first you need to make the four variables. One pair will be for the patrolling guard’s MAP X and Y coordinates, and another for your player’s MAP X and Y. These will help keep track of the player’s and guard’s positions on the map, via their respective X and Y coordinates.
The second, and somewhat tricky, part involves using conditional branches. You’ll be using three, one nested inside the other. One will be checking if the guard is looking a certain direction, and if they are, if the player is on the same X/Y position as them, then if the player’s X/Y is greater lesser than the guard’s. That’s all you need to do! Here’s what it looks like:
Set the route type to Custom and then make the route you want. Make sure to set this to Parallel Process, so this will activate without the input of the player but will not interfere with other events. Hope this helps any and every one in need.
NOTE:
This will give your guards unlimited vision in any direction they turn! If you’re looking for something with a limited vision, I would need to make a tweak in the event. I will update this as soon as I find a way to do so.