Help - Search - Members - Calendar
Full Version: [Eventing] Creating a Damage Formula
RPG RPG Revolution Forums > Game Engines > RPG Maker VX Discussion > RPG Maker VX Tutorials
Rukiri
In Rm2k3/xp/vx you need to make a dividend of numbers, ones, tens, hundreds, thousands etc.

But the actual damage formula is quite simple and it goes like this.

Let's set up some variables.

XXX: Damage = 0;
XXX: Hero_STR = Name Strength
XXX: Hero_DEF = Name Defence
XXX: AI_STR = 4;
XXX: AI_DEF = 6;

In a game you need to know NOT to make a AI to strong or too week basically if it's a AI that's semi strong just add 1 or 2 from his stength variable.

But let's take into account if the AI is intelegent, if so make sure the number is what it needs to be, the ai can be extremely intellegent but weak. But this can also be a very hard to hit AI meaning you have 1-5 chances of hitting the ai. But if the AI is as smart as the Hero the chances of hitting are increased.

Now that we know how to take stats into account let's create that bloody formula.

The Damage variable will be used in just about every line here.

CODE:

CODE
XXX: Damage equal to Hero_STR
XXX: Damage Divided by AI_DEF
XXX: Damage Times 3 by AI_STR
XXX: Damage Mod 3
XXX: Damage Minus AI_INTEL
XXX: Damage Add 5


Than you go ahead and just setup this formula with the dividend and there you go, a damage formula!

Note that you can go much farther with the formula than that, this was only for the tutorial. You can make any damage formula as complex as you need.
Rukiri
This is only the damage formula, take note that you have to create speed and intel and hit chance formulas for your AIs and Ally Ais.

Btw, this is for the main hero or whatever hero that's in your party, it's the same around for Enemy Ais, so when the code is done, it's done. It's just a matter of copy and paste afterwords.

Enjoy!


for showing multiple damages have a showing variable and create 10 damage events, yea I know a lot but if your firing a Kamehameha wave you want to see it continue right? and you only see about 10 anyway.

Example:

if damage_count = 0
damage 1
end
else if damage_count = 1
damage 2
end

etc.
DeadDemonDude
QUOTE (Rukiri @ Aug 23 2009, 12:55 AM) *
This is only the damage formula, take note that you have to create speed and intel and hit chance formulas for your AIs and Ally Ais.

Btw, this is for the main hero or whatever hero that's in your party, it's the same around for Enemy Ais, so when the code is done, it's done. It's just a matter of copy and paste afterwords.

Enjoy!



Dude this is awesome! It helps make battles like rpg games and less like you hit with 25 damage every single time, thats kinda lame.
But with this its awesome!
Rukiri
If you want more than 3 random damage counts just make more, just remember the last one is critical. It's best to create your speed formulas and intel formulas soon after.

I'll do speed right now as an example.

if [XXX] Rabite SPD >= M_Hero SPD
[XXX] Rabite avoid chance [0-3]
end
else if
[XXX] Rabite avoid chance [0-10]
end

It's not complete but it's the skeleton and if the enemy AI has a higher speed it's avoid chance is increased, but don't forget the Hero(s) can use speed boost items in game so the enemy might not ALWAYS have a upper hand.

And a tip on Bosses they usually have better stats than the Hero's do, there usually around 2-5 LVs higher, course the first boss is always 1 above.

If you need more Formulas for a RPG just ask, make sure there battle related.
Rukiri
Part 3: Showing the damage as numbers!

First off you need to know how to split the variables, also a quick note you're going to need a variable for each damage object, so like damage1 ones etc.

http://kobrasrealm.net/view.php?6

Okay, good we got that crap out of the way.

Now it's really up to you if you want to see 'Damage' as numbers but it's a cool effect and a lot of ABS systems use it. Come to think of it, all battle systems use it!

Now the way they're shown is up to you, in some games you'll see a damage of 15 but see 0015 so we need to set some IF statements to prevent such things, and it's always best to go from highest to lowest but that's just how I role/code.

CODE
Comment: Thousands

if [XXX: Damage Thous] = 1

else
end case
^. same just go til 9

Comment: Hundreds

if [XXX: Damage Thous] >=1
if [XXX: Damage Hund] = 0

end case
end case

^. Just repeat the Damage Hundreds variables with else cases until you reach 9
But remember the Damage thousands variable is only connected to the (0) not to 1-9!

Comment: Tens

if [XXX: Damage Hund] >=1
if [XXX: Damage Tens] = 0

end case
end case
if [XXX: Damage Tens] = 1

else
end case

Same as above, the 0 is only connected to the Hundreds variable, 1-9 is connected to the tens and ones variables.

Comment: Ones

Common knowledge, no need for a check for the ones value.


Pretty straight forward.

If you can't follow that maybe you can follow RM2k/3/XP/VX Event Script.

Kipe
blink.gif Just saw this thread! I am so bad at navigating the forums on this website. Anyway! The above event system looks almost exactly how I made mine! Except I used labels to help it process a small bit faster, because I may still have a lot to add on to mine in order to get multiple damages to display in succession. I'm still working on resources most of the time though. IMO contest to see whose evented ABS is better hahah.

Also I will probably end up changing this anyway so that 2 and 1 digit numbers are centered. But that's just a small cosmetic that doesn't really matter for now happy.gif


[Show/Hide] This is what mine looked like

I found a glitch in the above event system when displaying multiple 0's for a number like 1000. Only the 10_ _ would show. That Event system is outdated, but fixed in my most recent version
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.