Gw Temp

Menu

Tutorial - 'Advanced Damage Algorithms' by Guest

An item about RPGMaker 2000 posted on

Blurb

A tutorial by Omega_ on how to implement advanced damage algorithms into your CBS.

Body

ADVANCED DAMAGE ALGORITHMS

Made by Michiel Sikma (Omega)
Copyright © Avalanche Studios 2003

Hey, folks! Omega here! Some of you might know me as Omega_ from GamingWorld. I'm the one who created Tetra Valor, and I made the damage algorithm like the way I'm about to explain it to you.

Tetra Valor is still looking for spriters! At the moment, we're looking for chipsets kinda in the lines of Suikoden or FF5. If you're interested working for this project, feel free to contact me (omega@avalanchestudios.net) or post something in our featured project forum (Tetra Valor project forum (GW))!

A damage algorithm that carries your CBS's damage from very small numbers to the straight 9's you can deal in the end. This tutorial will guide you through some hard steps. Follow it carefully, and the prize will be yours.

STEP ONE

First, we'll need to set some information. This will be vital for your algorithm's alteration throughout the game.

1. Set the DEFENCE of your WEAKEST monster to something underneath 10 (e.g. 8, 4, etc.).

2. Set the DEFENCE of your STRONGEST monster to something like 120.

Now that we've set the monster's defence capability, we'll need to set the character's strength.

1 The STRENGTH of your characters must be a bit variable. Surely, your fighter should do more
damage at Level 1 than your wizard. So set the weakling's strength to somewhere around 3 and the strong man's strength to somewhere about 9.

2 The STRENGTH of your characters when they are completely levelled up should be about 100.
/ Don't worry, you'll still be able to turn low amounts of strength into high damage.

We've just set the basics. You're one step further to making your own unique CBS Damage Algorithm!

STEP TWO

So, it looks like we have the basics. Now, we need to think of an algorithm. First, let's consider making a basic algorithm. This will be a test event.

Make a new event with any picture. Set it to [Push Key] and [Same Level as Hero]. Put in the following data:

1 Note: This variable is the monster's defence.

2 SET VARIABLE: DEFENCE = 5
/ Setting the DEFENCE to 5, meaning it's a VERY weak monster.

3 Note: This variable is the character's strength.

4 SET VARIABLE: STRENGTH = 9
/ Setting the STRENGTH to 9. Strong, but a low level.

5 Note: Now let's start making that algorithm!

6 SET VARIABLE: DAMAGE = STRENGTH
/ Setting DAMAGE to STRENGTH

7 SET VARIABLE: DAMAGE / DEFENCE
/ Dividing DAMAGE with DEFENCE

8 Show message: \v[xxxx] Damage!
/ Replace XXXX with the DAMAGE variable number.

Now enter test mode and use the event! You'll see that it will return "2 Damage!". I guess you COULD agree with it, but let's not forget this is the strongest man of your team fighting with a strength of 9. It's a bit low, even though he's still just at level 1. Let's try to add something to make it a bit more.
Add SET VARIABLE: DAMAGE * 4 between 6 and 7.
This will return "7 Damage!" as output. This is a lot more acceptable, don't you think? You can change it if it doesn't suit your needs. Try to get this to an acceptable level, and then move on.

STEP THREE

Now, let's try to see what happens if we put the character's level to the max. We already stated that the strength of the strongest character should be around hundred at that level. So modify 4 to SET VARIABLE: STRENGTH = 100. This will give you a massive output, but don't forget we're still fighting weak monsters here! Change 2 to SET VARIABLE: DEFENCE = 66 to compensate this great strength increase (note that Defence=66 isn't the strongest enemy in your game. This is made to make sure you won't bash the hardest enemies with 9999 damage per blow).

Enter test mode and test these settings. It will return "6 Damage!" . . . which isn't good. Seems that the increased Defence compensated the increased Strength pretty well. This is logic, though, since we're dividing Strength with Defence. What do we need to do to prevent this? We add Increasing Power!

Between 5 and 6, make this code:

6 SET VARIABLE: LEVEL = 50
/ This is supposed to be set to the hero's level. Since we don't use that type of stuff right now, we'll just input 50 to indicate a fully trained warrior.

7 SET VARIABLE: STRENGTH * LEVEL
/ Multiplies the Strength with the level of the hero!

Go ahead and test your algorithm. It will give you "303 Damage!". Hmm, not enough. Duplicate line 7 (Set variable: Strength * Level). Make sure there's two of it. Now enter test mode again.
This time, it'll say "15152 Damage!". Wow! We've gone past the 9999 Damage limit! This is one of those points where you, as the game designer, have to think up what to do next. Will you leave it like that or will you tune down the damage a little bit? You could also make it harder to level up, making Level 50, thus the level of ultimate damage, extremely hard to get to. You might even want to further increase the damage to make it hit 99999!

If you want to tone down the damage by dividing the LEVEL variable by three and adding another one of those codes. This will make it 12^3 instead of 50^2, making the damage 10473. This is still above the standard damage limit, although acceptable, knowing the monster we're using in our test isn't the hardest monster.
To get it below 9999, first multiply the level by 10, then divide it by 45. This will make 11^3, bringing the damage to 8067.

STEP FOUR

Now here's an easy part. We're going to add a small randomiser. First, determine how you want your randomiser. I set mine to 19%, which is very similar to the randomiser of the DBS (Which is 20%). I suggest you don't go higher than that, else your algorithm will look as if it's just a random number between 0 and 9999. Add these lines of code to your event (at the bottom):

SET VARIABLE: RAND1 = Random 5 - 100
/ This will determine the percentage of the damage it will randomise. When it's 5, the percentage will be 20%. When it's 100, the percentage will be 1%, thus making it a 19% difference.

SET VARIABLE: RANDOM = DAMAGE
/ Sets RANDOM to the full damage

SET VARIABLE: RANDOM / RAND1
/ This sets the RANDOM variable to a percentage 1% - 20% of the actual damage.

Finally, your algorithm is complete. It is still just an experimental test, however. Now we can move on to the next step, turning this test event into a fully functional damage algorithm.

STEP FIVE

I'll give you everything you've got so far. This piece of code must resemble the code you made more or less (some variables, which you were able to fill in yourself, could be different).

1 SET VARIABLE: DEFENCE = 66
/ Setting the DEFENCE to 5, meaning it's a VERY weak monster.

2 SET VARIABLE: STRENGTH = 100
/ Setting the STRENGTH to 9. Strong, but a low level.

3* SET VARIABLE: LEVEL = 50
/ This is supposed to be set to the hero's level. Since we don't use that type of stuff right now, we'll just input 50 to indicate a fully trained warrior.

4* SET VARIABLE: STRENGTH * LEVEL
/ Multiplies the Strength with the level of the hero!

5 SET VARIABLE: DAMAGE = STRENGTH
/ Setting DAMAGE to STRENGTH

6** SET VARIABLE: DAMAGE * 4
/ Multiplying the DAMAGE by 4

7 SET VARIABLE: DAMAGE / DEFENCE
/ Dividing DAMAGE with DEFENCE

8 Show message: \v[xxxx] Damage!
/ Replace XXXX with the DAMAGE variable number.

9 SET VARIABLE: RAND1 = Random 5 - 100
/ This will determine the percentage of the damage it will randomise. When it's 5, the percentage will be 20%. When it's 100, the percentage will be 1%, thus making it a 19% difference.

10 SET VARIABLE: RANDOM = DAMAGE
/ Sets RANDOM to the full damage.

11 SET VARIABLE: RANDOM / RAND1
/ This sets the RANDOM variable to a percentage 1% - 20% of the actual damage.

* These lines may vary since we were allowed to choose between various ways of adding increasing power. It could have been 50^2, 25^3, 11^3, or whatever you thought was good for your game. Do not be confused by this. Just change codes you need to change, and don't delete things you don't need to delete because that increasing power code was corrupting the count (1, 2, 3, etc.) of lines.

** This line may vary because you were allowed to change *4 into something different, such as *6 or *12. This won't further affect the editing of the algorithm.

Now, to turn this baby into the real thing. First, delete the Show Message command (Show message: \v[xxxx] Damage!). This is the code that shows the damage in a little box. We don't need it anymore.
Change the SET VARIABLE: DEFENCE = 66 into SET VARIABLE: DEFENCE = MONSTER_DEFENCE. I always make an event at the beginning of the battle that sets the defence of the enemy. Just link back to that variable, and you'll have the right number to divide the damage with.
Change the SET VARIABLE: STRENGTH = 100 into SET VARIABLE: STRENGTH = HERO_STRENGTH. This will set the strength of the hero. I'm sure you know how to set the variable to the right strength if you have more than one hero fighting (by using switches or variables to check which hero is in what position).
Change the SET VARIABLE: LEVEL = 50 into SET VARIABLE: LEVEL = HERO_LEVEL. We'll need the correct increasing power, right? So set that variable to the level of the hero instead of 50.

Now that we've made the correct changes, we're supposed to store this Damage Algorithm into a nice Common Event for later use. Go to the Database (press F8) and search for the Common Events tab. Name an empty slot "Damage Algorithm" and copy the code you just made in there. Leave the common event on "On Call". This will allow you to be able to calculate damage from anywhere.

Well, I think that just about wraps it up! Know that this is the very basic algorithm. There aren't any extra's involved, except for that damage randomiser. You can add all sorts of things if you like, such as critical hits which treble damage, or elemental swords which are lethal to enemies of the opposite element. It's all in your hands... but for the time being, try out your newly generated damage algorithm!

Omega
Michiel Sikma, Digital Designer, RPG-maker, Member of Avalanche Studios
[e] omega@esper-eternal.net
[w] www.esper-eternal.net/forums

Tetra Valor
Project led by Omega, visit here:
[w] http://www.whahay.net/forums/index.php?act=SF&f=67
[w] http://tetravalor.avalanchestudios.net/