Gw Temp

Menu

Tutorial - 'Shooting and Hearing Part V: Guard Attack System' by ATARI

An item about RPGMaker 2000 posted on

Blurb

A tutorial on how to make guards in an ABS shoot back at you.

Body

Hi folks! It’s ATARI again! This time I’m going to talk about how to make an ABS guard attack system for your RPG. This Part V (five) to the shooting and hearing tutorial mini-series.



Things that you need to know to use this tutorial:

1. Variables

2. Fork Options

3. Switches

4. Set Event Command



So what exactly do I mean when I say and ABS guard attack system? Well, first of all, in rm2k, ABS stands for Action Battle System. An ABS is from Zelda style gameplay, to Metal Gear Solid gameplay. Anyway, so this tutorial is how to make guards shoot back at you when they see you. This tutorial won’t tell you how to allow your hero to fire back, but you can read that in the other shooting and hearing tutorials.



The first thing that you’ll need to do is create a new map. Make the map 25 x 25. (This is really only a test map, so you most likely won’t be using this for your actual game) Make the map mostly just walkable title, except that for this tutorial you will need something that looks like the picture below.







What that basically is a little room inside the room. You will see why you need this later. You will also need a 25 x 2 (25 tiles wide, 2 tiles high) space at the bottom of the map. This is where most of the events are going to be located.



The first thing that we are going have to do is make some events to start off. The first event that we are going to make is going to be an “on hero touch” event. Have it not have graphics, and make sure that it is “below hero.” Place this event on that 25 x 2 spot at the bottom of your map. Name this event “Guard1Sight.” The first thing that you do in here is make a switch event. Make it turn on the switch “Guard1_Alert.” Next, make a new change variable event. Use the variable “Guard1_shoot.” Now make

it choose randomly between 1 and two by using the random number part of the change variable event.

(It’s the one with the “Rand.” beside a little click button.) Below that event put in a new fork option that says, “IF variable ‘Guard1_shoot’ is equal to 1, then,” below here put in a sound animation that sounds like a gunshot, and wait 0.5 seconds. In the fork option’s else case (if it doesn’t have one already, set it within the fork option). In here make it wait 0.5 seconds, play the sound effect that you used for a shooting gun, following that put in a show battle animation event on your hero. Make the event a battle animation that makes it look your hero has been shot. Then remove 1 (one) from the variable “Hero_health.” (You would set the actual “hero_health” variable when you make the actual game by using an auto start event that sets the variable and turns off by using a switch)



So what have you done? Well the following has made it so there is 50% possibility that when the guard shoots at you he misses. When he hits you, it takes away one from your health and shows battle animation on you. Remember that when you are done setting this up you can change the possibility percentage and change the wait time as well to your liking. Now hit the apply button in the event, and then following, hit the okay button. Now right click on this event and copy and paste it 7 more times (you can make it more or less as you please when you are done setting up the system.) Now name them (Since the first was “Guard1Sight”, name the next one “Guard1Sight2” and so on until you have eight of them named.) For this tutorial, the guard will be able to see eight tiles in front of him/her, and nothing more (Remember that you can change this later on if you like.) Now it’s time to make a guard on your map.



Create a new event. Do not create this event on the 25 x 2 tile part, but on the main floor. (Not in your little room, or within 8 tiles of it). Make this event a parrell process type event (that is correct, a parrell process event) and make it on the same level as the hero. Give it the graphics of a guard and name the event “Guard1”. The first thing that you want to put in here is a wait 0.1 seconds event. Next, put in a change variable event. Have it use the variable “Guard1_X” and set that variable to this events X coordinate. Below that put in another change variable event for the variable “Guard1_Y” and set that variable to “Guard1’s” Y coordinate. Now below that insert a fork option that says, “IF event, ‘Guard1’ is facing up direction, then” (the face direction part of the fork options is on the second page under the part with the word “event” by a click button.) Now below that fork option (or anotherwards, not in the else case), set the event “Guard1Sight” by using a set event command to the x and y coordinate of “Guard1” by using the variables “Guard1_X” and “Guard1_Y” Then do the following for all the other “Guard1Sight” events (Events “Guard1Sight2” hrough “Guard1Sight8”) putting them on the same X and Y coordinates. After that is all done, put in a move event command. First, make a move event command for event “Guard1Sight.” In here have it [Move Speed Up] three times. Below that do the following:



|Start Sliptrough | (the start slip through part of it, (see picture below for where it is on the move event command) | Move Up | Stop Slip through|







Now go to your guard event and do what you did with the first move event. Have the amount they move two instead of one. To wrap it up after you’ve done this with all the move events, make it wait 0.4 seconds, and set the variables “Guard_X” and “Guard_Y” down to zero (0).



Below in the else case, make another fork option that says, “If event ‘Guard1’ is facing direction left, then” below that, go back to all the things that were under the first part below the fork option that you made for when the guard is facing up. Copy and paste that below under this fork option. Now you’ll have to go in to the move event parts and change them from moving upwards to moving to the left. Let the setting the event be the same, and the wait 0.4 seconds and the setting of the X and Y variables down to zero be the same as well.



Now in the else case, make another fork option that says, “IF event ‘Guard1’ is facing direction right, then,” you guessed it. Paste the information that you did earlier under the fork option and change the move event parts from moving to the left to moving to the right. When you are done with that, in the else case, make a fork option that says, “IF event ‘Guard1’ is facing direction down, then,” paste the information once more and change the moving from the right to moving in the downward direction. Now you have the basic part of it set up.



I have converted your sights events to graphics so that you can see how it works.







Oh dear! There seems to be a problem with your sight event’s going over the wall. Here is how to fix that.







See where the box is? That is where the guard would be able to start seeing inside of the room. How to fix this? Look at the X and Y coordinates below. They are located at the bottom of that picture above. Yes, the (005, 014) part. Now make a new event on the blank part of the map. Make this a parrell process. Have it wait 0.1 seconds, then set the guard’s X and Y coordinates using variables “Guard1_x2” and “Guard1_y2.” Below that, make a fork option that says, “If variable ‘Guard1_x2”’is equal to ‘5’, then” and below that fork option make another fork option that says, “IF variable ‘Guard1_y2’ is equal to ‘14’ then,” have it turn on the switch “Guard1_SevenSight”, and turn off switches “Guard1_SixSight” through

“Guard1_OneSight.” Now go back to your guard event, copy the page, and paste a new one. Remove

everything with the event “Guard1Sight8.” Make it’s starting condition switch be “Guard1_SevenSight.” Paste the page and on the next take away everything with “Guard1Sight7” and number eight using switch “Guard1_SixSight.”



Go back to the parrell process event that you just created. At the bottom of it set the X and Y variables that you used in the event to zero. In the else cases you can do the same things for other places on the map. It might seem really time consuming, but you can search for X and Y shortcuts. If there is a wall that goes across the whole screen for example, you could just make a fork that checks the Y coordinate, and things like that.



Finally, go back to your guard, Copy the first page, pate a new one and make it’s starting condition switch be “Guard1_Alert.” Make it’s movement to go after the hero. Then pate more that include switch “Guard1_Alert” and goes down through “Guard1_SevenSight” to “Guard1_OneSight.”



So that all there is to making a ABS guard attack system in your game. Remember to create more

guards, and remember that you can play around with the stuff as well.



Good Luck!

Remember,

“Even the greatest gamers were n00bs.”

- ATARI