RMMV Damage Formula - ideas and help

Cherry-sama

Veteran
Veteran
Joined
Oct 13, 2013
Messages
102
Reaction score
34
First Language
English
Primarily Uses
Hey, so I've been working on balancing damage formulas in my game, and so far I've been doing alright. However, I've recently encountered a problem with the formulas on the healing spells.

Right now I have the first level heal spell (single target) as "((a.mat / 2) + (b.mhp * 0.5)) / 2"... However, this kind of isn't doing what I was hoping it would... See, ideally, I'd like to have it so that when the player is level 1, the spell heals 50% of HP or higher. But when the player is at level 20, then they only get healed around 25%. That way, the lower level healing spells are super useful when it's all you know, but later the spell is not as useful, so they have to use higher level healing spells. However, I kinda don't want it to be a flat rate, like the default "damage" formula is, because I don't want Heal 1 to become completely useless by level 50.

I'm not really sure how to implement that, since "((a.mat / 2) + (b.mhp * 0.5)) / a.level" is too dramatic of a curve. Any suggestions?
 

Backwardskey

Phones
Veteran
Joined
Dec 22, 2015
Messages
39
Reaction score
12
First Language
English
Primarily Uses
RMMV
Is there a way for a skill to do almost, if not exact, the same amount of damage either being a physical or being a magical type class.

I tried "((a.atk + a.mat) / 2) - ((b.def + m.def) / 2)" but it only gives me a 1 damage (i'm using mr trivel's minimum damage plugin).
m.def? shouldn't that be b.mdf?
 

Backwardskey

Phones
Veteran
Joined
Dec 22, 2015
Messages
39
Reaction score
12
First Language
English
Primarily Uses
RMMV
Hey, so I've been working on balancing damage formulas in my game, and so far I've been doing alright. However, I've recently encountered a problem with the formulas on the healing spells.

Right now I have the first level heal spell (single target) as "((a.mat / 2) + (b.mhp * 0.5)) / 2"... However, this kind of isn't doing what I was hoping it would... See, ideally, I'd like to have it so that when the player is level 1, the spell heals 50% of HP or higher. But when the player is at level 20, then they only get healed around 25%. That way, the lower level healing spells are super useful when it's all you know, but later the spell is not as useful, so they have to use higher level healing spells. However, I kinda don't want it to be a flat rate, like the default "damage" formula is, because I don't want Heal 1 to become completely useless by level 50.

I'm not really sure how to implement that, since "((a.mat / 2) + (b.mhp * 0.5)) / a.level" is too dramatic of a curve. Any suggestions?
use a flat number to determine the power of the spell, and limit the influence of the caster's Magic stat.

Code:
power = 20
healing = power * (2 + a.mat * (a.lvl + a.mat))/256
 

Cherry-sama

Veteran
Veteran
Joined
Oct 13, 2013
Messages
102
Reaction score
34
First Language
English
Primarily Uses
use a flat number to determine the power of the spell, and limit the influence of the caster's Magic stat.

Code:
power = 20
healing = power * (2 + a.mat * (a.lvl + a.mat))/256
Wow, thanks! That's a really good idea! Um...should I divide by 256? The number seems a bit high...
 

thepsyche

Veteran
Veteran
Joined
Nov 16, 2016
Messages
256
Reaction score
65
First Language
English
Okay so, my math has never won any awards, and I'm only just starting with damage formulas. I've come up with... *something*... but I'm unsure if what I claim it is, is in fact correct. I'm betting it's not, because of what the engine decides to work out first.

Here's my formula:

a.atk * 4 - b.def * 2 + (a.atk * 4 / 100 * 35)

Now, what I INTEND for that to do, is give a boost of 35% to the total damage of the player's normal attack. The player's current atk is 10 (the enemy's defense is 12) in my tests, so that tells me the number it should get from the equation in brackets is 14... which would mean a total attack power of 54. Yet, 62 is the number I'm getting at the moment. I'm starting to realize the formula bar isn't a calculator. Where am I going wrong?

EDIT: The answer is, I'm not! I just didn't take into account the damage of the player's WEAPON! Duh.
 
Last edited:

Nhale

Villager
Member
Joined
Aug 22, 2014
Messages
5
Reaction score
4
Primarily Uses
Hey everyone :)
Quick question! How do i check in the formula if the target is equiped with a specific type of armor or weapon?
eg. if target is equiped with a sword ( weapon type 1 in the database) buff attack, if equiped with a heavy armor (armor type 3) buff defense
 

KVG

Villager
Member
Joined
Aug 17, 2017
Messages
16
Reaction score
1
First Language
English
Primarily Uses
RMMV
Hey everyone :)
Quick question! How do i check in the formula if the target is equiped with a specific type of armor or weapon?
eg. if target is equiped with a sword ( weapon type 1 in the database) buff attack, if equiped with a heavy armor (armor type 3) buff defense
a.hasWeapon($dataWeapons[1]) ? effect if true : effect if false;

I don't know what the code is for armor. For buffing, you probably want to add a state in the damage formula (b.addState(15),a.addState(40)) and use the state to manipulate your buffs/debuffs

new question

similar to above, I want to have a conditional statement based on weapon equipped... but multiple weapons.

How can i shorten:

a.hasWeapon($dataWeapons[1]) || a.hasWeapon($dataWeapons[4]) || a.hasWeapon($dataWeapons[9]) || a.hasWeapon($dataWeapons[17]) || a.hasWeapon($dataWeapons[20]) || a.hasWeapon($dataWeapons[5]) || a.hasWeapon($dataWeapons[21]) || a.hasWeapon($dataWeapons[3]) || ? d=2 : d=1;
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
965
Reaction score
708
First Language
English
Primarily Uses
RMMV
How can i shorten:

a.hasWeapon($dataWeapons[1]) || a.hasWeapon($dataWeapons[4]) || a.hasWeapon($dataWeapons[9]) || a.hasWeapon($dataWeapons[17]) || a.hasWeapon($dataWeapons[20]) || a.hasWeapon($dataWeapons[5]) || a.hasWeapon($dataWeapons[21]) || a.hasWeapon($dataWeapons[3]) || ? d=2 : d=1;
You can use Array.some() to shorten that.

Code:
[1,4,9,17,20,5,21,3].some(function(e){return a.hasWeapon($dataWeapons[e])}) ? effect if true : effect if false
 

KVG

Villager
Member
Joined
Aug 17, 2017
Messages
16
Reaction score
1
First Language
English
Primarily Uses
RMMV
You can use Array.some() to shorten that.

Code:
[1,4,9,17,20,5,21,3].some(function(e){return a.hasWeapon($dataWeapons[e])}) ? effect if true : effect if false
Worked like a charm, thanks

New question: I want a cure spell that can be used on dead and alive allies, but if they're dead, it will revive them before curing them. Here is what I have... I can target dead allies and alive allies equally, but when cast on a dead ally it just casts on the next actor instead, leaving the dead ally dead and unhealed.

a.level>5 ? d=5 : d=a.level; c=1+Math.randomInt(8)+(d) ; b.isDeathStateAffected ? b.revive() : 0; c
 
Last edited:

Kraden96

Friendly Fox
Veteran
Joined
Feb 5, 2016
Messages
39
Reaction score
11
First Language
English
Primarily Uses
RMMV
How would one go about showing the calculated damage of a skill in the skill's description?
 

Animebryan

Need more resources!
Veteran
Joined
Jul 31, 2012
Messages
350
Reaction score
163
First Language
English
Primarily Uses
RMMV
Is there a way to make critical hits ignore defense using the damage formula?
 

Rasikko

Warper
Member
Joined
Nov 12, 2017
Messages
1
Reaction score
0
First Language
English
Primarily Uses
RMMV
Edit: If anyone comes to thread, it's obviously dead and you want get help from anyone if you post here.
 
Last edited:

freebooter

Veteran
Veteran
Joined
Oct 20, 2017
Messages
104
Reaction score
5
First Language
German
Primarily Uses
RMMV
Hi guys,
@KVG and @Ossra already showed how to check the weapon-type of the attacker. What I want to ask is how to get the ID of the target-enemy? The idea behind is, that I would like to make the damage depending on the weapon and the enemy against which it is used. For example: A pierce weapon deals less damage against a skeleton.
How could a damage-formula that deals damage depending on weapon-type and enemy-type look like?
Thanks for your help!
 

freebooter

Veteran
Veteran
Joined
Oct 20, 2017
Messages
104
Reaction score
5
First Language
German
Primarily Uses
RMMV
Guys, nobody an idea about how to check which kind of enemy the actor is targeting?
 

Pharonix

Shadow Walker
Veteran
Joined
Apr 22, 2012
Messages
658
Reaction score
279
First Language
English
Primarily Uses
RMMV
Having trouble with a 'Sacrifice" skill with yanfly skill core.

I need cost to be equal to the character's current hp-1. and do that much damage.

not sure if i should use custom cost, or custom eval.

when using custom cost eval. can i do
cost = user.hp-1
then call cost in the damage formula?
 

Hungry Moogle

A Rat in the Wall
Veteran
Joined
May 4, 2017
Messages
36
Reaction score
7
First Language
English
Primarily Uses
RMMV
I was curious about creating a skill that would sacrifice half of the user's HP in order to heal the rest of the party equal to the amount given up.
How would one go about setting up such a skill?
 

Blue Symphony

Wandering soul
Veteran
Joined
Jan 24, 2014
Messages
60
Reaction score
22
First Language
Spanish
Primarily Uses
RMMV
@Pharonix
Maybe you figured it out by now; but this is my approach to that skill, in case anyone needs something similar.
Set up for a "Reduce your HP to 1 and convert the amount of HP sacrificed into damage" skill.
Damage formula
Code:
x = a.hp-1; a.setHp(1); x;

@Hungry Moogle
This one is kinda tricky. You'll need Yanfly's Skill Core, and Yanfly's Target Core plugins.
Set up for a "Halve your HP to heal all allies equal to the amount of HP sacrificed" skill.
Damage formula
Code:
a.hp
Notebox
Code:
<Target: All Allies But User>
<Custom HP Cost>
cost = Math.ceil(a.hp / 2)
</Custom HP Cost>
 

Hungry Moogle

A Rat in the Wall
Veteran
Joined
May 4, 2017
Messages
36
Reaction score
7
First Language
English
Primarily Uses
RMMV
@Pharonix
Maybe you figured it out by now; but this is my approach to that skill, in case anyone needs something similar.
Set up for a "Reduce your HP to 1 and convert the amount of HP sacrificed into damage" skill.
Damage formula
Code:
x = a.hp-1; a.setHp(1); x;

@Hungry Moogle
This one is kinda tricky. You'll need Yanfly's Skill Core, and Yanfly's Target Core plugins.
Set up for a "Halve your HP to heal all allies equal to the amount of HP sacrificed" skill.
Damage formula
Code:
a.hp
Notebox
Code:
<Target: All Allies But User>
<Custom HP Cost>
cost = Math.ceil(a.hp / 2)
</Custom HP Cost>
Thanks a lot! This actually works just as I wanted it to, including my addition of removal of Debuff status effects from allies. I just have two additional questions:

1.) Is it possible to remove the HP cost from the menu? I feel that its presence isn't necessary, especially since the skill description mentions that it halves the user's HP, also the HP cost obscures the MP cost for the ability which is a problem.

2.) I modified the formula for use with another somewhat similar skill that is intended to convert 1/4 of the user's HP into MP, and I've managed to get the skill working except for one small issue. The issue is that using the skill restores the user's MP for less than the amount of HP used, when the skill is supposed to restore the user's MP by the same amount of HP used. I'm guessing that the reason why this is happening, is that the amount of MP restored is based the user's HP after the HP cost is taken into account. I can't say for certain, and I'm not sure how to go about fixing it, so I included the formula for anyone whose willing to offer some advice into how I can fix it.

Damage formula
Code:
a.hp * 0.25
Notebox
Code:
<Custom HP Cost>

cost = Math.ceil(a.hp * 0.25)

</Custom HP Cost>
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I like Iron Maiden.
Benku wrote on Magnus0808's profile.
Hey man you helped me out a long time ago with a plugin i was wondering if you can help me out one more time since its literally the last thing i need help with if not is cool but id figured id ask you one more soild.
Stream will be live shortly with a guest stream! Tonight, a new guest joins~ Feel free to drop by!
Finally told my boss I need a day off. Tomorrow will be my first in 23 days.
Kind of a goofy question but has the pandemic inspired you in any way?

Forum statistics

Threads
95,421
Messages
929,039
Members
125,650
Latest member
Magidonsa
Top