RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[RM2K/3] Guard Detection Using Field-Of-View (MGS-Style)

0 Members and 1 Guest are viewing this topic.

Level 84
puking up frothing vitriolic sarcastic spittle
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.


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.