Gw Temp

Menu

Tutorial - 'Basic Side-View Battlesystem' by polski

An item about RPGMaker 2000 posted on

Blurb

Learn how to make a very basic side view battle system! Courtesy of Bartek.

Body

Welcome, this tutorial will teach you how to make a very basic side view battle system in RPGMaker 2000.
Before you start this tutorial make sure you know basics of switches and variables, I will still explain everything in full detail but some basic knowledge is a good help.

Section 1 - Setting Up
This side view battle system is VERY basic and can always be improved upon, I am open for suggestions and whatnot, if you want a more advanced battle system wait awhile while I develop one

Alright, first we need to setup a map where our battle will take place. So make a normal map
Place a few monsters on the map, in this tutorial I use only two monsters so I advise you do the same to minus confusion.

Section 2 - Coding
First thing you're going to want to do is make the 'Battle Start' event, So create a new event somewhere on the map, make it AutoStart. On the first page you really can be unique in your own way, this is what I put for my code:

() Change Hero's Walk Graphic: Battle -> Battle-1 set
;What I did here was set my main hero's graphic to a battle stance.
() Move event ...: Hero,Faceleft,Wait
;I make the main hero face the enemy
() Play SE: Monster
() Wait 1.0s
() Play SE: Monster
;Play the monsters sound effects
() Messg: Monster Attacks
: \|Monster 2 Attacks
;Show a message who is attacking.

Now we have to set some variables.
First make a variable called 'Enemy HP' and set it to what number you want the enemies HP to be. Mine looks something like this:
() Variable Ch:[0001:Enemy HP] Set, 5
Now do the same thing but with a different variable name for every other monster. Then make a variable containing your HP. Now, after all your variables are set, set a switch called Battle Start to be ON. Finally, create a second page for that event, and under Event Conditions make a check mark for one of the switches and select the Battle Start switch, leave the rest of the page blank.

Now we're going to want to create a Parallel Process that checks if one of the enemies or the hero has died. So create a new event as a Parallel Process, put it somewhere away from the battle area. Make it so it will only be activated if the Battle Start switch is set as ON.

Create a fork that checks if enemy #1's HP is 0, It should look something like this:
() FORK Optn:Varbl[0001:Enemy HP]-0
Under that fork make a switch called 'NME1 Dead' and set it as ON and then End that case. Do this but with the appropriate variable names for all the other enemies on your battle. Finally, do another fork like you just did but make this one checking if the main hero's HP is 0, if it is then Game Over..You can insert any 'Dying animations' or stuff like that into here at this point. After all those Fork options, make TWO more fork options that check if all the monsters are dead, should look something like this:
() Fork Optn:Switch[0001:NME1 Dead]-ON
  () Fork Optn:Switch[0001:NME2 Dead]-ON
And finally in that set a switch titled as END to be ON

Section 3 - Coding the Enemies
Well, now it's the hard part. Create an event with the image of your monster sprite, set it as Auto Start. Leave the first page blank and create a second page. Make it so it will only be activated if the Battle Start switch is set as ON (Do this under the Event Conditions area) Now to do the main work. Select the command called Cycle which can be found on the third page of Event Commands. Now do a Show Choice with options such as attack, skills and more. For this tutorial I will just have an Attack command and a Run Away Command (It shouldn't be to hard to figure out how to do other options such as skills once you're done this) So now my show Choice command allows me to select 'Attack' or 'Run Away' and I have added another choice which isn't really a choice but displays my current HP, so this is what my show choice command looks like:
() Show Choice: Attack/Run Away/HP: \v[1]
;Replace 1 with the variable number of your HP.
Now we're going to make the Attack Case. First make fork options checking if all monsters are NOT dead. I have two monsters so I made two Forks which look similiar to this:
() Fork Optn:Switch[0001:NME1 Dead] - OFF

Now make a Show choice command allowing you to choose which monster to attack. And once that is done make a case for each monster. In each case you can put in a bunch of animations like the main hero running up and attacking the monster. But one vital part is at the end, Change the Variable Value of Enemy #1's HP down one point. It should look something like this:
() Variable Ch:[0001:Enemy HP1]-, 1
What I basically did was go to the Change Variable Command, selected the enemy HP variable, Picked the - (minus) sign for the 'Set' area and picked Set: 1 for Operand. Now that you've done that, Select the Break Cycle command. Do the same above method with cases and all for each monster you have in your battle.

We have done a simple Attack Command, now for the Run Away Command. This is very simple, We do not always want the Hero to run away safely so first create a variable titled Runaway and Set it to be a random number between 1 and 2. Now create a Fork Option (Set it so ELSE case is on) that will be activated if the variable Runaway is 1, In this fork make the hero Run Away Safely, Do a fade out or whatever and then teleport back to the map. Then, in the ELSE case, put a message 'Could not run away'

Ok, you've finished your main commands, now we have to do Enemy Attacks. After the END Cycle for all your hero's commands, Create a Fork option that checks if the switch NME1 Dead is OFF, If so. Do the following: You can put in some animations and enemy movement now but the vital part is you must set the Variable of Hero's HP, down one point (Read above for method). Do this for each monster but with the appropriate variable names. Now, since we have two monsters we will need to create a third page on that same event. Make this page only activated if the switch NME1 Dead is ON. Change the enemies graphic into something blank so it appears dead..or even put a dead graphic! All you have to do here is Paste (Right Click Window for Options) all your events except for the point when you get asked which Enemy to attack, Delete the whole case of the first enemy or put something like 'Cannot attack Dead Enemy' Finally, make one last page in that same event, make it activated if the switch END is on and leave the rest blank. Go to your second enemy event and leave all the coding blank, simply make a second page and have it activated if NME2 Dead is ON.

Well, that's about it for this long tutorial, It was hard to explain with all these events everywhere but if you need more help check out our In-game Side View Battle System Example

Coming Soon: Much more Advanced Battle System tutorial using Pictures instead of Message boxes to display everything and more options! *gasp*