RMMV Damage Formula - ideas and help

luigiman2201

Villager
Member
Joined
Oct 30, 2015
Messages
16
Reaction score
2
First Language
English
this isn't a damage formula, but it is a formula related question.

i want to setup a formula that heals the target, and half back to the user of the skill. so if I heal a target for lets say 10 hit points, the user would get 5 back.
You can use a.gainHp and b.gainHp for that. (a is the user, b is the target)

Basically, input the damage formula, but divide it by 2 at the end.

For example, let's say the formula for calculating the amount healed is 75% of the user magic attack.

Then the formula would be

a.gainHp((a.mat * 0,75) / 2);b.gainHp(a.mat * 0,75)In the case of the simple example you've given the formula would be

a.gainHp((10) / 2);b.gainHp(10)Let me know if there's anything you don't understand, or if something didn't work right.
 

CyndaBytes

Creator and Destroyer of Worlds
Veteran
Joined
Aug 3, 2015
Messages
89
Reaction score
41
First Language
Italian
Primarily Uses
Hi guys, I'm trying to create a combat system that calculates the fighting level ( it's over 9000!!! XD) and fatigue.
There is a way to make this formula shorter?

Code:
a.atk * 4 + {[a.level + (a.hp/10) + (a.mp/10) + a.tp + a.atk + a.def + a.agi + a.mat + a.mdf + a.luk]/9} - b.def * 2 + {[b.level + (b.hp/10) + (b.mp/10) + b.tp + b.atk + b.def + b.agi + b.mat + b.mdf + b.luk]/9}
 
Last edited by a moderator:

okugi

Villager
Member
Joined
Oct 27, 2015
Messages
28
Reaction score
6
First Language
English
Hi guys, I'm trying to create a combat system that calculates the fighting level ( it's over 9000!!! XD) and fatigue.

There is a way to make this formula shorter?

a.atk * 4 + {[a.level + (a.hp/10) + (a.mp/10) + a.tp + a.atk + a.def + a.agi + a.mat + a.mdf + a.luk]/9} - b.def * 2 + {[b.level + (b.hp/10) + (b.mp/10) + b.tp + b.atk + b.def + b.agi + b.mat + b.mdf + b.luk]/9}
A couple things.

-It looks like you're taking the average of all stats, including level, but dividing by 9, vice the 10 parameters you listed in each section.

-Without  plug ins, this formula won't work for combat, as enemies don't have levels or tp.  This would work for skills that are targeting other party members though.

-In general, I don't think this formula will accomplish what you want, as written.  Currently, you're adding both the attacker and defenders stats to the final damage, instead of doing a comparison.  Let's try grouping the attacker and defenders portions,  

(a.atk * 4 + ((a.hp/10 + a.mp/10 + a.atk + a.def + a.agi + a.mat + a.mdf + a.luk)/8)) - (b.def * 2 + ((b.hp/10 + b.mp/10 + b.atk + b.def + b.agi + b.mat + b.mdf + b.luk)/8))

Or you could use it as a fraction to modify the a.atk-b.def portion:

(a.atk*4-b.def*2)*(((a.hp/10+a.mp/10+a.atk+a.def+a.agi+a.mat+a.mdf+a.luk)/8)/((b.hp/10+b.mp/10+b.atk+b.def+b.agi+b.mat+b.mdf+b.luk)8))

I think the second one would serve your purpose better, as it creates a direct comparison between the attacker and defender, and modifies the damage based on that outcome.

Run both through your favorite spreadsheet to see which numbers you like better.  Hope that helps somewhat.
 
Last edited by a moderator:

lohenien

Veteran
Veteran
Joined
Mar 15, 2012
Messages
153
Reaction score
7
First Language
english
Hi guys, I'm trying to create a combat system that calculates the fighting level ( it's over 9000!!! XD) and fatigue.

There is a way to make this formula shorter?

a.atk * 4 + {[a.level + (a.hp/10) + (a.mp/10) + a.tp + a.atk + a.def + a.agi + a.mat + a.mdf + a.luk]/9} - b.def * 2 + {[b.level + (b.hp/10) + (b.mp/10) + b.tp + b.atk + b.def + b.agi + b.mat + b.mdf + b.luk]/9}
My game's combat style is anime focused. To represent power levels I'm using mp as a multiplier as such: ((a.atk +a.agi) * (3+ (1+(a.maxmp / 500 ))) having mp equal to 500 is like being super saiyan one, 1000 mp would be super saiyan 2 etc. Most enemies and characters will have between 100-300 mp until the mid game then some characters and enemies will get boosts to take their damage to the next level. I dont know if something like that will help, but it is easier / shorter.
 

Silenity

Veteran
Veteran
Joined
Dec 17, 2013
Messages
649
Reaction score
242
First Language
English
Primarily Uses
RMMV
So currently I have this in my attack formula:

b.isStateAffected(4,5,6,8,9,10,26) ? (a.atk) - (b.def / 4) : (a.atk / 2) - (b.def / 4)
I'm trying to make it so you deal increased damage if affected with one of those states.

However, it only seems to be applying on the first state (4) which is poison in my case.

What am I doing wrong?
 

VHStapes

Game Designer
Veteran
Joined
May 25, 2014
Messages
57
Reaction score
7
First Language
English
You need to use "||" (which means "or") instead of "," between each number. So something like b.isStateAffected(4 || 5 || 6) would work, I think.
 

dayhjawk

Veteran
Veteran
Joined
Jul 5, 2015
Messages
107
Reaction score
12
First Language
English
Primarily Uses
I'm not even sure if this is possible:

I am wanting to setup a skill that does more damage if target is at full health.

then again, if he's above a certain %.
 

Smelipanda

Veteran
Veteran
Joined
Oct 25, 2015
Messages
40
Reaction score
36
First Language
English
I'm not even sure if this is possible:

I am wanting to setup a skill that does more damage if target is at full health.

then again, if he's above a certain %.
b.hp == b.mhp ? A: (b.hp/b.mhp > .40 ? B : b.hp/b.mhp > .35 ? C : b.hp/b.mhp > .30 ? D : b.hp/b.mhp > .25 ? E : F )

A being the Damage if they are at full health

B being the Damage above 40% but below/equal full health

C being the Damage above 35% but below/equal 40%

D being the Damage above 30% but below/equal 35%

E being the Damage above 25% but below/equal 30%

F being the Damage below/equal 25%

im fairly new to this so there may be eaiser or more effective ways to do it, but it appears to produce the results you are looking for :) .
 
Last edited by a moderator:

dayhjawk

Veteran
Veteran
Joined
Jul 5, 2015
Messages
107
Reaction score
12
First Language
English
Primarily Uses
full hp, 25%, 30%. 35%, 40%

there different ranks
 

MakeAndCreate

Veteran
Veteran
Joined
Jul 3, 2014
Messages
39
Reaction score
3
First Language
English
Primarily Uses
I'm trying to work on a skill that becomes a finishing move when the enemy is below 25% health and adds an exhaustion state to the user, but only does a fix damage otherwise.  For some reason I can't get the formula to work

b.mhp/4 > b.hp ? a.addState(11); 9999999999999 : 50

What am I doing wrong?  
 
Last edited by a moderator:

Smelipanda

Veteran
Veteran
Joined
Oct 25, 2015
Messages
40
Reaction score
36
First Language
English
I saw a couple of posts here but wasnt abler to get a solid answer (or maybe im a complete dunce and just missed it). is there a way to affect the crit rate for 1 attack and 1 attack only? idk if you would need a script, or use the damage formula to do it or?
 

skyshadow235

Villager
Member
Joined
Oct 25, 2015
Messages
21
Reaction score
1
First Language
English
Primarily Uses
is it possible to use a formula that calculates the user's base attack without equipment, but while he/she is equipped with a weapon?
 

Smelipanda

Veteran
Veteran
Joined
Oct 25, 2015
Messages
40
Reaction score
36
First Language
English
is it possible to use a formula that calculates the user's base attack without equipment, but while he/she is equipped with a weapon?
This would likely need a script written for it. I dont think there is any easy way to get the attack bonus from a weapon and subtract it from the total.
 

Myst Desdemona

The Snark Knight
Veteran
Joined
Nov 18, 2015
Messages
69
Reaction score
15
First Language
English/Swedish
I'm not sure if this was answered before in this thread since I last checked over a week ago, so my apologies if it was already answered.

I'm trying to make it that if a consumable is used on one specific actor, it would have a different effect (in this example heal more) I remember it vaguely from vx being something like this

if b.id == 1; 200; else; 100; end;

How can I transition this to MV?

Thanks in advance.
 

BloodletterQ

Chaotic Neutral Assassin
Veteran
Joined
Aug 15, 2012
Messages
1,462
Reaction score
1,062
First Language
English
Primarily Uses
N/A
Wondering if I would need a plug-in that replicates doubling from Fire Emblem where having a higher stat than the stat of an enemy enables an extra attack or if that can be included within a formula.
 
Last edited by a moderator:

gotnovicks

Veteran
Veteran
Joined
Feb 15, 2015
Messages
76
Reaction score
9
First Language
Portuguese
Primarily Uses
N/A
Does v[id] still works on formula box? like v[50]+=1 add 1 to variable 50.

If dont, how do I make it through $gameVariables in formula box? because $gameVariables.setValue(id,value) overwrite the value, not add >:
 
Last edited by a moderator:

Sol Rising

Veteran
Veteran
Joined
Oct 25, 2015
Messages
162
Reaction score
21
First Language
English
I'm not sure if I need a plugin or if this can be done via formulas. I'm trying to come up with a attack that deals damage to the target but has a x% chance to apply a stat effect on the user. Any help would be greatly appreciated
 

BloodletterQ

Chaotic Neutral Assassin
Veteran
Joined
Aug 15, 2012
Messages
1,462
Reaction score
1,062
First Language
English
Primarily Uses
N/A
Also, how do I make a skill that casts another random skill?
 

TheGamedawg

Veteran
Veteran
Joined
Aug 29, 2014
Messages
350
Reaction score
133
First Language
English
Primarily Uses
I'm having a little bit of trouble finding a damage formula that works for my game.  Basically what I have is a game without a level up system.  Characters and enemies have an attack/defense stat that is anywhere from 1-31, unless augmented by equips.  Additionally, all of these characters have a health stat from 100-200.  Bosses have far more, but that's because they're bosses.

I'm having trouble getting a good damage formula for this.  I want the average attack, 15 attack to 15 defense to do around 20 damage or so.  And at most 31 attack to 1 defense to do around 100.  I'm having trouble finding a formula that gets this working though.  Everything I try simply does too much damage.
 

Nuhada

Villager
Member
Joined
Oct 26, 2015
Messages
27
Reaction score
14
First Language
French
Does v[id] still works on formula box? like v[50]+=1 add 1 to variable 50.

If dont, how do I make it through $gameVariables in formula box? because $gameVariables.setValue(id,value) overwrite the value, not add >:
You can set something like "x = $gameVariable.value(id); $gameVariables.setValue(id,x + value)"

Maybe there is something like $gameVariables.addValue(id,value), but i didn't test.

I'm not sure if I need a plugin or if this can be done via formulas. I'm trying to come up with a attack that deals damage to the target but has a x% chance to apply a stat effect on the user. Any help would be greatly appreciated
This has been answered before, you should check out old pages before asking.

Just use "(Math.random()>X)?(a.addState(Y));damages", with X between 0 and 1 for the chance (0=0%, 0.5=50%, 1=100%), and Y as the ID of the stat.

I'm having a little bit of trouble finding a damage formula that works for my game.  Basically what I have is a game without a level up system.  Characters and enemies have an attack/defense stat that is anywhere from 1-31, unless augmented by equips.  Additionally, all of these characters have a health stat from 100-200.  Bosses have far more, but that's because they're bosses.

I'm having trouble getting a good damage formula for this.  I want the average attack, 15 attack to 15 defense to do around 20 damage or so.  And at most 31 attack to 1 defense to do around 100.  I'm having trouble finding a formula that gets this working though.  Everything I try simply does too much damage.
It's just my opinion but i'll put something like (a.atk*3 - b.def*1.5)+5, with a minimum damages of 1. This is not a crazy formula but it makes the job x)
 

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

Latest Threads

Latest Posts

Latest Profile Posts

A wave of cold air has hit Canada... I know it's "always cold", but this one is especially cold... I'm freezing to death lol.
Have fun with English: a "fire grenade" is not portable napalm but a fire extinguisher tool.
2 days ago someone tried to convert me to Islam. Today youtube tried to convert me to Catholicism. The only thing left would be to meet sone Jehova's witnesses.
I just successfully tested changing music by region, and changing it between continents on the world map after getting on/off the airship. I had to override the default audio transitions with eventing to make it change smoothly but it worked.
Stream will be going live shortly with some more Witcher 3, then we will switch to another game! Feel free to drop by~

Forum statistics

Threads
93,417
Messages
912,173
Members
122,923
Latest member
VampKiryu
Top