Sunday, July 17, 2011

Tutorial: MGS-Style Guards In RPGMaker

Instead of just blabbing on about other people's attempts at amateur development all the time, I figured I would start posting some tutorials for anyone out there who's considering using something like RPGMaker to create a game. Since most of my experience is with the RPGMaker programs, I'm going to focus a lot of these tutorials on those engines, but I hope the general concepts carry across and that people can also use these tutorials to work out how to make things in other programs too!

Without further ado, here is the first in this series of tutorials: How To Make MGS-Style Guards In RPGMaker!

-------------------

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.
  

5 comments:

  1. Pretty good work. Personally I could never stand RPGmaker.

    ReplyDelete
  2. yeah im with loneislander :)

    ReplyDelete
  3. Wow nice! Hit me back, alphabetalife.blogspot.com

    ReplyDelete
  4. great guide! could use some pics to better explain some of the topics though. thanks!

    ReplyDelete
  5. ... I agreee with electric addict: for beginners moar screenies would be nice, but if you used RPGM before it shouldn't be a hassle, thou.

    Thanks for the tut ^^

    ReplyDelete