Gw Temp

Menu

Tutorial - 'Making a gun battle system.' by Vexx

An item about RPGMaker 2000 posted on

Blurb

A HUGE tutorial on creating a well done gun battle system

Body

The central core of the game is based on 3 events: one that will be the bullet itself, one that places the revolver event under the hero, and one event that displays the life bar and makes it possible to pause the game.

Start by creating the Revolver event. Change the start condition to Push Key. This event will follow the hero, and when the players push a key it will shoot. Leave this event blank for now.

Now make a second event called Check and make it a parallel process. This event will check the player position all the time. Make 2 variables, Hero-X and Hero-Y, and make 2 actions on this event:

Variable change - Hero-X / set hero-X position
Variable change - Hero-Y / set hero-Y position

And now make an action that places the Revolver under the hero:

Set-up events place: Revolver (variables hero-X and Hero-Y)

Now even if the hero moves the Revolver event will still be under him.

Now open the Revolver event again and make an action:

Change switch - Revolver - On

That activates the Revolver switch when the player push's a key, doesn't matter where he is. Now open the Check event and make a new page. As a condition for this page set
The switch revolver on. Leave the page blank. When the player shoots the Revolver events will no longer be under the hero, until the Revolver switch is on.

Now to the shooting part. Open the Revolver event again. Make a new page and as a condition set the Revolver switch on. Make 2 new variables: Rx and Ry (these will be the Revolver position). Now make 2 actions on this page:

Variable change - Rx / set this event-X position
Variable change - Ry / set this event-Y position

Now make 4 fork conditions. On the first make as condition - Hero Right face direct. Inside the case put an action: Change switch - rightfacerev - on. That means if the hero is facing right when the player pushes the key, this switch will be activated.

Make the same for all directions. For up face direct make as action Change Switch - upfacerev - on. And so on.

Now make 4 new pages on the Revolver event. For the first page the condition should be the switch rightfacerev - on, and so on

The order of the last 4 page on the Revolver event doesn't matter. Open the page where the condition is the Rightfacerev switch on. Choose a picture for the event, like a bullet or something. Make a new action to change the hero graphic (unless you're ok with your hero doesn't move when he shoots). Now make a new action:

Move event: this event, Right, playSE, switch off (Revolver), switch off (rightfacerev).
(Ignore if can’t be moved)

What this does: If the hero is facing right and you push a key, the Revolver event will turn into a bullet and go right, until it finds a wall or an enemy, then will play a sound effect and disappear, returning to its position under the player and starting the process again.

Make the same with the other 3 pages. You can just copy and paste but remember to change, in the move event, the position to where the bullet goes.

If u used the change hero graphics on the Revolver event, open the Check event. On the first page, make a new action: Change hero graphics, and change it to the original graphics.

The enemies

Make a new event. On the first page change the start condition to on hero touch. That means the enemy will hurt the player when it gets close to it. Leave it blank for now. Make 4 pages for the enemy, and for each use one of the 4 switches as start condition (rightfacerev, upfacerev...). Start with the one with the Rightfacerev condition. Make it parallel process. Make the following actions:

Variable change - Rx / set revolver-X position
Variable change - Ry / set revolver-Y position
Variable change - Mx / set this event-X position
Variable change - My / set this event-Y position
>>>>>Variable Change - Mx / -1<<<<<

Fork Condition: Variables Ry - My are the same
- Fork Condition: Variables Rx - Mx are the same
- - Move event (wherever you want it to do when he gets shot)
- - Flash character (this event - 0.5 sec - wait) the colour you want
- - Variable Change - Enemy 1 life / +1

Important: For the enemy life, make a variable on a reserved space for all the enemy lives. If enemy1 life is variable 21, all the variables until 40 are reserved to enemy lives. You will understand this later.

Explaining the actions: If the players is standing in the left of the enemy, and shoots right, the "hurt point" of the enemy is now his direct left square. If the Revolver event and the enemy hurt point are the same, the actions marked in blue will occur.

Make the same with all the 3 pages, but the action marked with arrows must be different for each:

Rightfacerevr: Variable Change - Mx / -1
Leftfacerev: Variable Change - Mx / +1
Downfacerev: Variable Change - My / -1
Upfacerev: Variable Change - My / +1

That changes the hurt point depending on where the hero is when he shoots.

Now make a last page for the enemy; witch will be when he is dead. As condition, set to Variable Enemy 1 life / 5 or above. When the enemy gets shots 5 times this page will occur. Make it a parallel process, make the actions you want (like playing a sound effect) and make a cycle event, with a wait action. Make sure you changed the graphic.

Life bar and loosing life with the enemy

First u need to have a life bar, or create it (paintbrush works just fine). We will work with a bar with 5 lives. Create a new variable, Hero Life. Now make a common event called LIFE (call event) and make these actions:

Fork option: Variable Hero Life- 0
- Show picture: 5 (the life bar is full)
- erase picture: 1, 2, 3 and 4.

Fork option: Variable Hero Life- 1
- Show picture: 4 (the life bar has 4 energy)
- erase picture: 1, 2, 3 and 5.

Fork option: Variable Hero Life- 2
- Show picture: 3 (the life bar has 3 energy)
- erase picture: 1, 2, 4 and 5.

Fork option: Variable Hero Life- 3
- Show picture: 2 (the life bar has 2 energy)
- erase picture: 1, 3, 4 and 5.

Fork option: Variable Hero Life- 4
- Show picture: 1 (the life bar has 1 energy)
- erase picture: 2, 3, 4 and 5.

Every time the event LIFE is called, the menu is displayed according to the hero’s life. A good position is 250,10.

Open the enemy event and go to the first page, the one with the hero touch condition. Make these actions:

Change HP - All members / -1 (impossible death)
Variable Change - Hero Life / +1
PlaySE
Call event: LIFE
Flash Character - Hero (0.5 sec, wait)

When the hero touches an enemy, it looses one hp and the variable Hero Life increases one, so the menu displays his health -1. As the menu needs to be called by a common event that is not a parallel process, it has to be called, so it "updates" the life bar.

Pausing and teleporting

There's just one more thing missing. When you are teleported, the life bar disappears, because it needs to be called. This third main event you have to do, called Pause, will solve this problem.

Make the first page a parallel process and as action:

Call event: LIFE
Change Switch: Call life - on


And make a second page with the condition Switch call life on. That means when you get to a map, the life bar will be called one time only.

Now to the pause itself. Make the second page a parallel process and make the actions:

Enter password (any useless variable, starts with the Cancel key)
Change switch: Pause - on

When you press Esc, the pause switch will be turned on. Make a new page with the pause switch as condition, and make it auto start.

Set Screen Tone (any darker tone)
Play bgm (the same bgm, but a lower level)
Show picture 7 (paused text)
Enter password (also starts with the Esc key)
Erase picture 7
Play bgm (back to the high level)
Set screen tone (normal tone)
Change switch - Paused - Off

This is just an example. When you press Esc, the screen gets darker, and the music will lower and a big Paused text appears on the centre of the screen (take a look at the game).

Finishing

You're almost done. Make a new common event called Livesto0 and make it a call event. Make these actions:

Variable Change: 21 to 40 / set to 0 (That's why you reserved these to the enemy lives)
Change Switch: Call life - Off.

Now every time you make a teleport event make this action:

Call event: Livesto0

And all the variables for the enemies will be set to 0 again, and the menu will display correctly.



A Few Tips

- If you make enemies that only have one life you can use switches instead of variables to control their lives.
- If you're making an object that acts when it gets shot, you don't have to do the same thing you do with normal enemies. For instance, if it is a switch, and it is on the right wall, just make the hurt point for the switch a block to the left, and as condition the hero must be facing right. So when he shoots right it will hit the hurt point and activate the switch.


A Few Notes

- The Revolver Event MUST be the first event on every map. So every time you make a new map, copy and place the Revolver Event before you do anything else.
- You need to place the 3 main events on all the maps.
- If your teleport seems bad, like when you teleport the enemies you just killed appear on the screen before you are teleported, make an action on the teleport event that erases the screen, then call the event livesto0, and make another action, show screen.
- If you skipped the tutorial and you're just coping and pasting the events, remember to copy the 2 common events. You may need to copy the life bar and the Pause picture as well.
- If you use this method in your game, plz give me some credit for it!
- this is intended to be a tutorial, so try not just copying and pasting the events in your game. If you understand how these events works you can do some neat things, and not just be limited to simple enemies.




By Vexx
If you want a tutorial on how to make enemies shoot at the hero from a distance E-mail me at joy@mcleod78051.freeserve.co.uk or MSN 12.00 to 1.00 GMT with the same address as my E- mail.