Jump to content
Lord John Baker

Creating a skill like 'Revenge'

Recommended Posts

Topic says it all.

I am trying to figure out the formula to make an attack that deals damage like the skill Revenge from final fantasy lore.

It deals more damage as the HP of the caster goes down.

I have the basic idea behind it, but once the enemy starts taking damage, it does WAY too much damage if the enemy has more than 9999 HP.

What I want to figure out is how to reduce the overall damage potential of the attack, without having to limit the move to enemies with low HP values.

I know the formula is something like this:

 

a.mhp - a.hp

 

What I want to know is, is there a way to make it so it doesn't deal exactly the amount, like is there a way to divide the damage so it only deals say, 10% of that value so I can give it to bosses with say, 15,000,000 HP and not have it 1 shot the party members every time it gets used?

 

As I said, if an enemy has 10,000 HP or more, the attack deals way too much damage, I mean, dealing 9999 in a single hit is a lot, but that should be expected, but the problem I have is, once there is more that that, once the enemy has 20K, 50K or more, the attack can 1 shot party members and the boss is no where near defeated.

 

Share this post


Link to post
Share on other sites

10% of 15 million is still more HP than your actors will likely ever have.

You need to be more specific with how your damage calculation will work.

 10% of 15 million was an example, i highly doubt that I would even give this attack to a monster that powerful, maybe as a final attack sure.

Plus, as i said, I want the attack to deal less damage when the boss has more than 10K HP, I don't know how much more specific I can be there.

 

To reiterate, the attack should deal damage equal to the amount of damage the enemy has taken, but I want to be able to reduce that if a boss has massive amounts of HP.

Share this post


Link to post
Share on other sites

I don't know how much more specific I can be there.

I want to be able to reduce that if a boss has massive amounts of HP.

Reduce by how much? Do you have a formula or something of that nature? Edited by Tsukihime

Share this post


Link to post
Share on other sites

This was taken from Fomar's tutorial on custom formulas:

(200 - ((100*a.hp)/a.mhp)*(a.atk * 4 - 2 * b.def))/100

It's supposed to double the damage of the ability when the user is almost dead. I haven't tested it yet, but I was planning on using it for an ability in my game. You can always tweak the formula to make it do more/less damage as you see fit.

 

This works in percentages, so it doesn't matter how much raw health the user has.

Share this post


Link to post
Share on other sites

You should use percentage. If you do 100/A.mhp*a.hp you'll get the percentage of the remaining HP. You can then reverse it and multiply it by the attack or magic value. Actually, doing 1/a.mhp*a.hp is better to use (otherwise you would probably have to divide the result by 100).

 

Here's an exemple :

-The monster have 300 max HP and curently 30 HP

- The damage formulla could be : 1/(1/a.mhp*a.hp)*a.atk

 

-Damage calculation : 1/(1/300*30)*a.atk = 10*a.atk ---> with 10% hp the attack does 10*atk

 

This formula means that 1% hp remaining, the attack will do 100*atk as damage, which may be to much, but you can still modify the result.

 

Other examples :

-1/(1/a.mhp*a.hp)*(a.atk/2)/10 ---> With this, as the attack is divided by two, the damage range (wich was 0 to 100 times atk value, with 50% hp making 2*atk value) is now 0.5 to 50 times atk value, and since the result is then divided by 10 it actually does 0 to 5 times atk value, with 50% hp beeing 0.1*atk value.

-1/(1/a.mhp*a.hp)*1000 ---> This sets the damage as beeing a percentage of a fixed value, here 1000.

 

EDIT : I forgot to add something : you could also just make that attack depend of the target's hp (or mhp) so that damage can't be above target's mhp.

 

Exemple : (a.mhp*a.hp/100)*b.mhp/100 or (a.mhp*a.hp/100)*b.hp/100.

This formula makes the target loose the percentage of HP that the caster has lost. The second version makes the target loose percentages of his actual hp (rather than mhp) so that you can never die from this attack. <---No it doesn't ! IT DOESN'T ! There, said it.

 

There's a lot of possibilities in this. I'm probably going to use these kind of skills starting now, thank you for that.

Edited by Da_B

Share this post


Link to post
Share on other sites

And this is why I failed Math Class in college... Stupid math...

 

@Da_B - Wow, thank you for that, these formulas may be just what I'm looking for, I'll have to throw them into the editor later and see what I come up with.

I am also glad that I inspired you and for that I'll add one of my own that I created with trial and error.

What I have here is a more complex Demi spell; instead of just reducing HP by a fraction, it does so based on the max HP and current level of the character it hits, this obviously makes it an enemy only skill in this form unless you have a way to give Monsters a level. In my game its actually an enemy only ability called "Level ? Gravity"

 

b.mhp * b.level / 100

 

It can obviously be tweaked a little seeing that as is it would deal 9899 HP if at Level 99 you had 9999 HP.

Using it with a break limit script would also be an issue because over level 100 I believe it would always do more damage than your max HP... I think...

Ok so it isn't perfect, maybe you can take a look at it and see what you can do?

 

 

@Harmill - Hmm, this formula looks functional, I may have to look at it too.

 

@Tsukihime - Yes and no, what I really want is just, as seen in the following posts, the kind of formulas I'm getting, its like it shows.

I want to make a skill that gets stronger as the enemy gets weaker, but I don't want it to be forced to be limited to enemies with low max HP amounts because the attack gets too strong.

 

 

 

Share this post


Link to post
Share on other sites

Just create two skills with the same name: one for enemies that have a reasonable amount of HP, and another for enemies with too much HP.

 

Then you don't have to worry about all of these complicated conditions.

Edited by Tsukihime

Share this post


Link to post
Share on other sites

 1/(1/a.mhp*a.hp)*a.atk

Tried this out. Kept returning 0 damage, no matter the health.

 

I don't understand why everyone is making this complicated.

(a.mhp/a.hp)*a.atk

 

Edit: Read your requests, now I understand why people are making it so complicated. Try this formula.

 

[(a.mhp/a.hp)*a.atk, 9000].min

It will do more damage as hp decreases (a.mhp/a.hp) but only to a maximum of 9000. (The min makes it the (a.mhp/a.hp)*a.atk or the 9000, whichever is lower).

Edited by Karaigan

Share this post


Link to post
Share on other sites

@Da_B - So I tried a bunch that you posted, most just returned null damage no matter what, maybe I input something wrong? I don't know.

 

@Karaigan - Yours worked, it seems to scale funny, where it would jump from doing like 2000 damage to suddenly 5000 damage but otherwise it seems to work OK for a baseline. Maybe I'm looking for something that can't be done, because when I did try yours, I made an enemy with max HP 999999 and the attack didn't start to get more powerful until the boss was almost dead. The same thing happened when I made a monster with only a max of 5000 HP, it dealt about 900 damage until the boss was almost dead, then suddenly the damage went sky high.

Share this post


Link to post
Share on other sites

John, yeah it will do that from the mhp/hp part. It is a simple fraction. Until the person gets below 50% health it won't do much damage at all. To fix it you could do stuff like;
[(a.mhp/a.hp)*(4 *a.atk - 2*b.def), 9000].min

 

That uses that normal damage formula, so it is doing a normal attack times the health ratio. Or;

[(a.mhp/a.hp)*(10 *a.atk), 10000].min

Edited by Karaigan

Share this post


Link to post
Share on other sites

 

 1/(1/a.mhp*a.hp)*a.atk

Tried this out. Kept returning 0 damage, no matter the health

 

Indeed. Maybe rm doesn't like numbers below 1 since a part of the formla goes with inverted numbers. Though that's not a problem since it's the exact same as what you wrote (a.mhp/a.hp)*a.atk. I was quite stupid to not see that, sorry about that. So replace all 1/(1/a.mhp*a.hp) with a.mhp/a.hp. With this  having 10% hp left you'd make 10*atk value damage.

 

You could also go for (((a.mhp*a.hp)/100)*(a.atk*n))/100 to deal n*a.atk damage relative to your hp percentage. It does'nt seem to workproperly though, as if the last /100 wasn't taken into account. Anyone got any idea ?  <--- it works properly, I just mixed myself up here, that thing's not to be used. Man, i'm beggining to think I should rework my math a bit...

 

Edit  2 : Okay, done ! And I quite needed to go over my math again : it was such an easy thing to do and yet I struggled as hell (in fact I couldn't even do it without checking out on my old highschool notes). So there :

 

a.hp*100/a.mhp   This returns the current percentage of HP. If used as such : (a.hp/a.mhp)*4*a.atk; it allows to do 4*atk as damage to the target when full on HP. Tested and working !

 

(a.hp/a.mhp)*b.mhp or (a.hp/a.mhp)*b.hp These allow to damage ennemi (or player) HP by removing your current HP percentage to the ennemi's HP percentage for the first case,  and as percentage to the ennemi's current HP for the second case. Not tested but should work.

 

100-(a.hp*100/a.mhp)  This returns the percentage of HP lost. If used as such : (1-(a.hp/a.mhp))*4*a.atk; it does increasing damage from 0 to 4*atk proportionally as your HP decreases. Tested and working !

 

(1-(a.hp/a.mhp))*b.mhp or (1-(a.hp/a.mhp))*b.mhp  These allow to damage ennemi (or player) HP by removing the percentage of HP you've lost to the ennemi's HP percentage for the first case, and as percentage to the ennemi's current HP for the second case. Not tested but should work.

 

And again, sorry for the earlier mistakes.

 

from John L. Nelson III

What I have here is a more complex Demi spell; instead of just reducing HP by a fraction, it does so based on the max HP and current level of the character it hits, this obviously makes it an enemy only skill in this form unless you have a way to give Monsters a level. In my game its actually an enemy only ability called "Level ? Gravity"

 

b.mhp * b.level / 100

 

I'll think of what I can for that to, but not now. It's 2 in the morning where I live... Gotta sleep a bit or I'll go mad...

Edited by Da_B

Share this post


Link to post
Share on other sites

Call me the Forum Custom Formula expert.

 

I've created over 300 spells and abilities for other games and written over 10,000 lines of code for said spells and abilities. While this has been partially outside of RPG Maker lets face it, most these formulas translate over from game to game.

 

What you need is a floor and a ceiling. This can easily be achieved by a percentage and a simple subtraction formula.

 

First you decide the maximum amount (ceiling) of damage Revenge will do.  Lets say in this instance 5000 damage.

 

Then you decide the minimum amount (floor) of damage Revenge will do.  Lets say 2000.

 

5000 - 2000 = 3000.  3000 is our range.

 

Since hp/mhp is a percentage, our life is a bit easier.

 

5000 - 3000*a.hp_rate

 

This means at 1% hp the enemy will deal close to 5000 damage.

 

At 100% hp it will only deal 2000hp.

 

at 50% it will deal 3500hp.

 

Simple, easy.  You can have multiple forms of Revenge too.  Revenge 1, which has a floor of 300 and ceiling of 1000. Then Revenge 2 which has a floor of 1500 and ceiling of 2500. etc.

 

If you want something more of a flat rate though, you can tie the percentage into a growing stat.

 

For an enemy only skill, you can tie it into Level.

 

You will need a formulated ceiling and floor now.

 

300*a.level

 

This will now scale with the level of the actor hit.  A level 10 actor will be dealt 3000 damage by this formula while a level 1 actor will be dealt 300 damage.  A bit steep though right? So break it down to a base and growth.

 

250+50*a.level

 

Now it's 300 at level 1 and 750 at level 10.

 

We could have a formula thats:

 

425+75*a.level - (250+50*a.level)*a.hp_rate

 

This formula should scale well.

 

Then you'd make one for Players to use. The formula would have to be special since enemies don't naturally have a level. In this case you'd want to scale it with a static parameter that enemies do have. Attack, Agility, Defense, Max Health, Max Mana, etc. Though you could use the enemy formulated one for players to use as well.

 

So the formula would look more like:

 

400+10*a.luk - (300+6*a.luk)*a.hp_rate

 

I trust this makes sense and feel certain it's what you're looking for.

 

To add on, Karaigan has a few working ideas. Your floor rate could be the attack formula and your ceiling could be 3 times the attack formula, meaning it's like a boosted attack based on hp percentages.

 

EDIT: Changed the hp/mhp to hp_rate.

Edited by Titanhex

Share this post


Link to post
Share on other sites

5000 - 3000*b.hp/b.mhp

 

This means at 1% hp the enemy will deal close to 5000 damage.

This means when the receiver is at 1% health the attacker will deal 5000 damage. Which is kinda useless. Although it would be quite interesting as a normal damage mechanic, aka you take more damage the lower health you have.

When I say useless I mean for the player character, at 1% health 5000 is going to overkill the enemy unless they have 500,000 max health.

 

Edited by Karaigan

Share this post


Link to post
Share on other sites

Ahh yeah. Mixed up the a and b in the formula.

 

Just convert it from b.hp/b.mhp to a.hp/a.mhp and you'll have it right. Simple and easy fix. (I'll fix it in the post too)

 

Also noticed I meant to reference your post at the end, not Da_B. Though Da_B has some good formula ideas too.

 

In your case clearly "useless" is a subjective term based on the numbers inputted.  As an example though it illustrates the idea perfectly, and continues on to more plausible ideas. Plus lets face it, if you get this off at 1% health you're going to want to do some heavy damage.

 

This brings up a good point though. You may want an exponential damage increase.

 

This is simple. Use an exponential factor.

 

I.E.

 

1*1 = 1

2*2 = 4

3*3 = 9

4*4 = 16

 

As you see just by increasing the base number by 1 we create a rising growth in the output.

Now how do we use it?

 

Well we can do an exponent growth on the hp rate. We'd basically tack this on to the end of our formula:

 

+ (1-a.hp_rate)*100*(1-a.hp_rate)*100

 

So at an hp rate of 1% hp missing, we'd do 1 (1*1) bonus damage, but at 99% hp missing we'd do 9801 (99*99) bonus damage which is still a lot more than 50% hp missing, which would only deal a bonus of 2500 hp (50*50). As you can see with this setup our damage becomes far more serious as the hp missing becomes far more serious.

 

However it may be too high. So we'll need to reduce the pattern via a simple percent to alter range.

 

+ ((1-a.hp_rate)*25*((1-a.hp_rate)*25

 

Here we will only deal a max of a little over 600 damage. At 50% hp it will only be a bonus of 170.

Edited by Titanhex

Share this post


Link to post
Share on other sites

Yeah, useless was poor word choice. Especially since right after I listed a use for it. xD

About the heavy damage, for sure. John will probably end up having to have two skills, one for enemies to use and one for players, as the differences in max health make it hard to choose a maximum damage output.

 

Theoretically a skill like

if a.id == 1; [(a.mhp/a.hp)*(4 *a.atk - 2*b.def), 100000].min; else; [(a.mhp/a.hp)*(4 *a.atk - 2*b.def), 7000].min; end;

should work. Haven't tested it as I don't have the time currently.. But it should hit between (4 *a.atk - 2*b.def) and 100,000 if the character is actor id 1. Otherwise it would hit between (4 *a.atk - 2*b.def) and 7000.

If Xypher is right then

if a.id == 1; [(a.hp_rate)*(4 *a.atk - 2*b.def), 100000].min; else; [(a.hp_rate)*(4 *a.atk - 2*b.def), 7000].min; end;

should also work.

 

Edited. Because one won't work and the other won't fit.

if a.id == 1; [(a.mhp/a.hp)*(2*a.atk), 100000].min; else; [(a.mhp/a.hp)*(2*a.atk), 7000].min; end;

Fits. And it works, but scales drastically. And is only useful for one player character. If more than two player characters are going to use the skill it would be easier to make one skill for the players and one skill for the enemies.

Edited by Karaigan

Share this post


Link to post
Share on other sites

I may be mistaken, but wouldn't [(a.hp_rate)*(4*a.atk - 2*b.def), 100000].min be interpreted as such?
 
If the value before the comma is less than the value after the comma, use that. Otherwise use the value after the comma.  Meaning there would be no range, only use one, or the other.
 
The adjusting value would be a.hp_rate*(4*a.atk - 2*b.def), which is a formula that logically would gradually grow into less than a normal attack and only be up to a normal attack at no hp missing.
 
I would fix it, but I'm not sure the exact logic that was being sought out.
 
I've tested and confirmed that this is indeed the case.
 
I do think though that a .min or even a .max is a great way to create a floor and ceiling on values.
 
Personally, if it was my Revenge formula, I'd probably use something to the effect of:
 
200+20*a.luk-(150+15*a.luk)*a.hp_rate + (1-a.hp_rate)*30*(1-a.hp_rate)*30

Share this post


Link to post
Share on other sites

Wow I leave for a few hours and I come back to see things that remind me of a math test nightmare...

Albeit the formulas provided so far may be just what I need, I haven't actually tried them myself.

 

@Titanhex - Yes, I do believe its exactly what I'm looking for but I haven't tested it yet to play with it.

I plan to have my actors be able to reach greater than 9999 HP, but even with that in mind, there is no true damage cap in VXAce, so unless my characters had more HP that the Monsters max, Revenge would 1 shot them every time, no matter what.

I also appreciate all the extra formulas you added, they look awesome and might allow me to use some additional enemy only spells.

 

While I'm thinking of it, is there a way to make a formula so it only effects characters if they are of a set number in there level?

I am, of course, referring to spells from Final Fantasy such as Level 2 old, Level 3 confuse, level 4 flare and, my personal favorite, Level 5 Death. just to name a few examples.

Edited by John L. Nelson III

Share this post


Link to post
Share on other sites

or you can use hp_rate instead of hp/mhp

 

Well that's a... big shortcut. Thanks for the tip.

 

What I have here is a more complex Demi spell; instead of just reducing HP by a fraction, it does so based on the max HP and current level of the character it hits, this obviously makes it an enemy only skill in this form unless you have a way to give Monsters a level. In my game its actually an enemy only ability called "Level ? Gravity"

 

b.mhp * b.level / 100

 

Your actual formula isn't bad it remove b.level% hp to the target. Of course, if the level is above 99, you'll remove 100% hp or more.

You can also make it with b.hp instead of b.mhp so that it only damage a percentage of the current hp. Then you can substract anything or divide the result by any number to weaken the effect : (b.mhp * b.level / 100)/2 that would make the attck emove 50% of the target's hp if the target is level 100.

You can also use Titanhex's range formula to limit damage to a set minimum or maximum.

 

A possibility I like would be : 0.75*b.hp - 0.7*b.hp * b.hp*b.level/100. That should make dammage go between 0.05*b.hp and 0.75*b.hp depending on b.level.

Share this post


Link to post
Share on other sites

While I'm thinking of it, is there a way to make a formula so it only effects characters if they are of a set number in there level?

I am, of course, referring to spells from Final Fantasy such as Level 2 old, Level 3 confuse, level 4 flare and, my personal favorite, Level 5 Death. just to name a few examples.

 

if b.level == 4;do_something;end

 

Would do something if the targets level is 4.

 

if b.level % 4 == 0;do_something;end

 

would do something if the targets level is divisible by 4.

 

if [1,5,15,23,33,48].include?(b.level);do_something;end

 

would do something if the targets level is any of the numbers in the bracket.

Share this post


Link to post
Share on other sites

Oh awesome, I'll have to play with those later and see what I can do.

Just asking, what does do_something;end actually DO in the formula?

 

Using your formula I created this one: 9999 - 9999*a.hp_rate

This actually creates the ability to the exact way I want it to work, and I tested it, and it works.

I made an enemy with 115,000 HP, and at max HP it did 'null' damage.

after dealing 4000 +/- it dealt about 300-400 damage.

as HP went down, Damage went up.

near death the attack dealt around 9000.

 

So thank you for your help, and thank you to everyone who helped too, this was actually a team effort.

Hopefully I can also get these other formulas working too...

Share this post


Link to post
Share on other sites

I may be mistaken, but wouldn't [(a.hp_rate)*(4*a.atk - 2*b.def), 100000].min be interpreted as such?

 

If the value before the comma is less than the value after the comma, use that. Otherwise use the value after the comma.  Meaning there would be no range, only use one, or the other.

 

The adjusting value would be a.hp_rate*(4*a.atk - 2*b.def), which is a formula that logically would gradually grow into less than a normal attack and only be up to a normal attack at no hp missing.

 

I would fix it, but I'm not sure the exact logic that was being sought out.

 

I've tested and confirmed that this is indeed the case.

 

I do think though that a .min or even a .max is a great way to create a floor and ceiling on values.

 

Personally, if it was my Revenge formula, I'd probably use something to the effect of:

 

200+20*a.luk-(150+15*a.luk)*a.hp_rate+((1-a.hp_rate)*100*0.3*((1-a.hp_rate)*100*0.3

 

It seems the topic is solved now, but for the point of clarification. When I said it would be hard to choose a max damage I meant because of the vast difference in max health between player characters and monsters.

 

[(a.hp_rate)*(4*a.atk - 2*b.def), 100000].min (under the assumption a.mhp/a.hp = a.hp_rate) would range from a normal attack damage (full current hp) to normal attack damage times max health. So if someone had 5000 health, 100 atk, and the defendant had 100 def.

At 5000 health it would do (1*(400-200)). 200 damage.

At 1 health it would do (5000*(400-200)). 1,000,000 damage.

However because of the [..., 100000].min the formula will take whichever is lower. Which makes the damage range from 200 to 100,000 instead of 200 to 1,000,000.

 

Edit: Testing it out. You are right. At 1 health it was doing 0 damage. Which is strange because [(a.mhp/a.hp)*(4 *a.atk - 2*b.def), 9000].min worked perfectly.

So a.hp_rate must be equal to a.hp/a.mhp and not the other way around like I understood.

Edited by Karaigan

Share this post


Link to post
Share on other sites

Just asking, what does do_something;end actually DO in the formula?

 

Unless you've created a method in the Game_Battler or Game_BattlerBase class do_something will kick back an error.

 

Right now I just threw it in as filler to tell you to put something there.

 

For instance:

 

if b.level % 4 == 0;950;end

 

Would do 950 damage if the targets level is divisible by 4. 0 otherwise.

 

250;if b.level % 4 == 0;950;end

 

Would theoretically do 950 damage if the targets level is divisible by 4. 250 otherwise.

 

@Karaigan: I like the idea, however it is very difficult to balance such a formula. All the highest damage happens at the most critical of values and from there explodes exponentially. At 1hp 1 million damage. Yet at 100 hp you only do 10,000 damage. And at 1000 HP only 1000 damage. Even on low max HP enemies the damage explodes at near critical. The formula is actually heavily fluctuated by the enemy hp and the base damage value, meaning it has a very small margin of numbers that will work when plugged in.

It has a lot of potential and you have to really be mindful of how you fight enemies with this formula of revenge. In this way it's a truly hit or miss skill best seen on random encounters, but definitely not in a boss fight.

Share this post


Link to post
Share on other sites

@Titanhex - oh, somehow I figured that, but I wasn't sure.

I tested them out, the first one works and only hurts characters whose level is divisible by 4, the second one does the same as the first one though, it doesn't hurt everyone and do more to targets of matching level, but that's OK because I like that better.

 

Now a question, I want to make skills that deal status effects with this same level based formula, but the issue I have is that it just seems to use the status effect even if they should not meet the level requirement for said ailment. They don't deal any damage, they just deal the effect of the ailment.

 

Ex: Level 2 poison, Level 3 Confuse, Level 4 Silence and Level 5 Death

 

I've tried to do it on my own, but as I said, It just keeps afflicting everyone, and I'm not good with any kind of code or these formulas so I can't figure it out.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×