Help - Search - Members - Calendar
Full Version: [Eventing]Guard Detection Using Field-Of-View
RPG RPG Revolution Forums > Game Engines > RPG Maker 2000 / 2003 > RPG Maker 2000 / 2003 Tutorials
Fallen-Griever
This is a tutorial for a guard system using a field-of-view. I would use the phrase "cone-of-view", but since RPGMaker isn't brilliant when it comes to forming cones (since it uses square tiles) I will use the word field instead.

The guards in this tutorial will "see" the 6x3 field in front of them (1 square either side of them and six squares in front) no matter what direction you cause them to walk in. This area can be changed by modifying the variables used and I will tell people how to do this if they ask for a specific area. Since this is always true, though, they can technically "see" through walls, around corners etc. Unfortunately, making guards that miss out hiding places is very specific to the set-up of the map in question, so I can't cover that in an unspecific way. Again, if you want to do this then I can tell you how if you ask.

Anyway...

To make this system you are going to need two variables;

Guard X
Guard Y

You are also going to need two switches;

Guard Gets You
Guard Dead*

*Of course, if you want the guard to do something other than fight you won't need this switch. Instead of turning this switch on, just turn off the Guard Finds You switch at the end of the second page. See later.

The guard event needs to have 3 pages. The first page will be a "Parallel Process" and will be set to "Move By Route". You can set any route you want, the guard will always respond to the direction they are facing in. The code for the event should be something like this:



This will trigger the second page whenever the guard "sees" the hero walking around. The second page I chose was for the guard attacking the hero, but if you want to do something else then just replace the code in the second page with whatever cutscene you have cooked up. In any case, the second page should be set to "Auto Start" and also set to "Stay Still". It should look something like this, keeping in mind that the trigger for this page is the "Guard Gets You" switch being on:



The final page is triggered when the battle is over, and is simply a page of nothing. Of course, if you want to have the second page not kill the guard and simply teleport the hero back to the entrace or whatever then instead of turning on the "Guard Dead" switch turn off the "Guard Gets You" switch. It really depends what you want to happen, this is just a basis.

Whatever you choose to do, the event that completes this sequence should be a blank event that is set to "Below Hero" and "Push Key". It does nothing at all, so I shouldn't need a picture, just keep in mind that the last page is triggered by the "Guard Dead" switch being on.

And that's it.
Shofixti
This is a really awesome idea! And it all look's so straightforward too!
Well done sir.
Fallen-Griever
It is fairly simple once you understand the underlying concept (how co-ordinates work in RPGMaker). It is also a lot better than having static guards and a load of events on the floor that you turn on and off!
Zenu_The_Druid
Just in case anyone else reads this, there is also a script that can accomplish this. (Fallen-Griever, if you want me to remove this link then let me know)
Stealth Detection System
Fallen-Griever
It doesn't bother me. RMVXP users are probably better off using a script because it is more efficient, although I do not condone copy and pasting things into your game when you don't understand them...
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.