Gw Temp

Menu

Tutorial - 'Directional Turret System' by ATARI

An item about RPGMaker 2000 posted on

Blurb

Need a turret like the ones in Deus EX or Splinter Cell? This tutorial is the one you want then.

Body

Hi folks, it’s ATARI again! This time I’m going to talk about how to create a directional turret system in your RPG!

Things that you will need to know to use this tutorial:
1. Variables
2. Fork Conditions
3. Switches
4. Labels
5. Common Events

So what exactly do I mean when I say a, “directional turret system?” Well, if you have ever played any of the Splinter Cell games, you know what system I am referring to. If you have never played any of the Splinter Cell games, then I will briefly explain what exactly the system is. Basically, there is a turret set up, and if it detects you walking past it, with the direction of the guns facing you, it will shoot at you. However, you can dodge it by getting something or someone in front of the turret to take the bullets, or find another way around and disable t the turret. Take a look at the picture below as an example of what I am talking about.



So the first thing that you need to do is create a new map in rm2k. Make it’s size 20 x 15, and make the entire map grass tile. Place a hero starting position on this map, so that when you go to test your game, you don’t have to mess with ending up on a different map than the one that you are currently creating.

Next, you will need to insert an event that resembles a turret. You might have to search around the Internet, or create one yourself. Once you find a graphic that resembles that of a turret, create a new event at the top (or bottom) of your map. Have its graphics be that of the turret, and have it face upwards. Make it a push key event. Make sure that its position is “same layer” as hero, and have there be no event commands in the event command box of the event. Name this event, “turret.” Hit the okay button. You should now have a picture on your map of a turret facing upwards from the very bottom of the map.

The next thing that you need to create is another new event. Create a new event and make this newly created event a parallel process event. Name the event, “Turret System 1.” Make it’s graphic’s blank, and have it’s position be below hero with no graphics. In the event commands, create a new change variable event. In this change variable event, choose the option of event, and choose the turret event. Use the variable “TurretX.” In the pull box that is beside that, choose to set that variable to that event’s x coordinate. Then hit he okay button. Following that, insert another change variable event. Create a new variable called “TurretY.” Make this variable bet set to the turret event’s y coordinate. After that, hit the okay button, and then the apply button on the event commands.



Next, create another change variable event below that once again. This time, create the variable called “HeroTurretX.” Select it that it chooses to set the variable to the Hero’s x coordinate. Create another with “HeroTurretY,” and have it set to the hero’s y coordinate. Then hit the okay button on the change variable command. Then insert a new fork condition. Have this fork condition say, “IF variable ‘HeroTurretX’ is equal to variable ‘TurretX, then,” below that, insert another fork condition command that says, “If switch ‘TurretOFF’ is OFF, then” Leave this portion of the fork condition blank for now. In the else case, insert another fork condition that is identical to the first fork condition that you created, and below that, insert a fork condition that is identical to second fork that you created, except that it asks if switch ‘TurretOFF’ is ON. Leave the rest of this case blank too.

Now return to the map and create another event that is right beside the turret. Make this event have the graphics that resemble something that looks like a box of electronics. Make this event below hero, and make it a push key event. In the event commands, have it display a message that says, “Do you want to disable this turret?” or something like that. Then insert a show choice option with the choices, “Yes,” and “No.” Under the “Yes” case, have it turn on the switch “TurretOFF.” Under the no case, have it turn the switch “TurretOFF” off. Next, create a new page. Make it’s starting condition the switch “TurretOFF.” Make it’s attributes the same as the first page, and then in the event commands display a message that says “Do you want to turn this turret on?” and then show the same choices. Under the “Yes” case, have it turn off the switch “TurretOFF,” and under the “No” choice, have it turn on the switch “TurretOFF.” This is the event that allows you to disable the turret.



Next, go into the database (F8) and create a new common event. Name this common event, “Turret System 2.” Make it a parallel process, and have its starting condition switch be a new switch called “TurretShooting.” In here, have it play a sound effect of shooting, have it remove 5hp from the hero’s health by using the change character health command. Then have the screen flash red for 0.1 seconds, and make sure that the “wait while flashing” option is NOT checked. Then below that, insert a wait 0.6 seconds event. Basically what happens, is when your hero is in front of the turret, he will get shot ever .6 seconds and lose 5 health points each time he is shot. Hit the apply and then the ok button.

Now go back to the “Turret System 1.” Event. In there, go under the else case event. In there, have it turn off the switch “Turretshooting” and stop any sound effects. Go to the original fork option, and have it turn on the switch “Turretshooting.” Now, there should be an additional else case as well. This is for the next part, when there is something in the way of the turret.

To create something that goes in the way of the turret, you would probably need a way of pushing that object in front of the turret in the first place. However, I’m not going to talk to you about how to create, because that in itself can be it’s own tutorial. So just for this tutorial, create a new event that is in front of the turret. Name this event, “Object1.” Return to the “Turret System 1” event and click on the fork condition and right click and hit “insert.” Then choose to create a new change variable event. This should place a new change variable event above the fork condition. In here, use a new variable called “object1x.” Have it be set to the event, “Object1’s” x coordinate. Then create another change variable by doing the same thing, and use variable “object1y” and set it to “Object1’s” y coordinate.



Now in the first fork option (the one with the call event) part, before the call event, insert a new fork condition above it that says, “If variable ‘object1y’ is not equal to ‘TurretY, then.” This fork condition should operate as normal. Now go under the next else case (not the one already used) and insert a fork condition that says, “If variable ‘HeroTurretY” is equal to “TurretY”, then.” Then below that, insert another fork condition that says, “IF switch ‘TurretOFF’ is OFF, then.” And then below that fork, insert a new fork condition that says, “If variable ‘object1y’ is equal to variable “TurretY,” then.” Insert another that says, “If variable ‘HeroTurretY’ is less than, variable ‘object1y’ then,” have nothing happen below that. Now copy that code, and insert it in the next else case, and then change the last fork to ‘If variable ‘HeroTurretY’ is greater than variable ‘object1y,’ then” have it turn on the switch “Turretshooting,” just like the original fork condition option #1. In the final else case, have it turn off the switch “Turretshooting,” and have it disable any currently playing sound effects.

So that is all that there is to creating a turret system in your RPG! Remember that this is just a basic engine, and you can expand on this as much as you want.

Remember,
“Even the greatest gamers were n00bs.”
- ATARI