Gw Temp

Menu

Tutorial - 'How to make a variable based ABS' by Dimensionwyrm

An item about RPGMaker 2000 posted on

Blurb

A cool tutorial by Lunchman that shows how to make an ABS where your attacks vary based on enemy attributes, such as speed and defense.

Body

First of all, this will be a LONG tutorial. So if you don't want to read a lot, just use the coding. By a variable based ABS(active battle system, if you don't know), I mean you set a variable for each stat and that affects the outcome, as in how much damage was dealt, etc.

For this tutorial, you will need:
An attack animation for the ABS with each direction.
Moderate knowledge of variables and conditional branches.
Basic knowledge of rm2k3

---Step 1---
First off, create each animation, 1 for each facing. Give it a sound effecr and flashing if you want.

---Step 2---
Create a common event. Name it attack, or whatever. Make it parallel procees, and make the start condition if the switch possible attack is on (this is to check if you are outside, so you don't end up whacking a king with a sword before you talk. Make a key input process and set it to the decision key. Uncheck the do not wait until key hit box. Make a conditional branch if the variable you set is 5.
Make a conditional branch for if the hero is facing up. Under the yes condition, make it show the attack animation for up. Have it memorize the hero's position. Then turn on the switch attack. have it wait 0.2 seconds, to reduce lag and so that the hero doesn't attack repeatedly, giving a machine gun effect. Now under the else case remake that for each facing, each within the previous' else case.Her is the code:
<>key input proc.:[attack]
<>Branch if variable [attack] is five
<>Branch if hero facing up
<>show battle animation: attack up, hero, wait
<>switch operation:[attack] ON
<>Memorize location:[hero id], [hero x], [hero y]
<>wait: 0.2 sec.
<>
:Else Handler
<>key input proc.:[attack]
<>Branch if variable [attack] is five
<>Branch if hero facing right
<>show battle animation: attack right, hero, wait
<>switch operation:[attack] ON
<>Memorize location:[hero id], [hero x], [hero y]
<>wait: 0.2 sec.
<>
Repeat for the other facings.
---Step 3---
Here create the enemy. Make its graphic, no start condition, on collision with hero, and same layer(For this page). In the coding, set a variable to hero defense. Make a conditional branch to check if that variable is greater than equal to x(the monster's attack, you choose). In the yes condition, lower hero hp by 1. In the else case make a change variable that sets a variable to the monster's attack. now lower the variable monster attack by the variable hero defense. Lower hero hp by that amount. Here is the coding for page 1:
<>variable operation: [hero defense], set to hero defense
<>Branch if variable [hero defense] is 10 or more
<>change hp: hero hp 1 remove
:Else Handler
<>Variable oper: [enemy attack] to 10
<>Variable oper: [enemy attack]-, var [hero defense] value
<>Change hp: hero hp V[enemy attack} remove
---step 4---
On to page 2, for when you attack the enemy. I don't have much time left today, so I will not give coding. Sorry!

Make this the same except that The start condition is that the switch attack from earlier is on. Set a variable to the enemy's x pos. and y pos. Check if the hero is facing up. have it lower the variable hero y by one. Check if the variables are equal. In the yes case have it set a variable to the hero attack, hero accuracy(intellect), and hero speed. Make a conditional branch to check if the variable hero attack is less than or equal to x(the enemy's defense)
In the yes case, have another conditional branch that checks if the variable hero acc is greater than or equal to x( the enemy's avoid) If so have it lower enemy hp by 1. In the else case have it set a variable 1 trough 2 and make another conditional branch that chacks if that variable is one.In the yes case, lower enemy hp by 1. Back to the else case from earlier that checked about the hero's attack. Do the same thing as earlier except instead of lowering enemy hp by 1 lower the variable hero attack by x( which was the enemy defense which you decided earlier). NOW lower the enemy hp by the remainder of the hero attack variable.
Remake that for each facing, except for right increase the variable hero x by 1, for down increase hero y by 1, and for left lower hero x by one. At the end Make a conditional branch to check if enemy hp is equal to zero. Have it erase event and if you want, grant experience points.
When you enter the map, set the variable enemy hp to the number you want!

That's just about it, but if I left any thing out just post it in a comment. If you use this please give me credit!

P.S. If you want after the attack have it check if the hero's speed is high enough, then you can show the animation again and have it lower enemy hp again, giving a double attack effect.