# RMMV Damage Formula - ideas and help

Discussion in 'RPG Maker MV' started by Shaz, Oct 25, 2015.

1. ### brendonxVeteran

Messages:
85
Likes Received:
5
Location:
Australia
First Language:
English
Hey guys and gals,

My formula "v[3] * a.atk + a.atk * 4 - b.def * 2" is working perfectly with the exception being that it won't do damage on the first turn.

I can't figure out why. Can anyone help?

For the record, it's a charge up style attack that increases in strength each time a player uses a certain skill in the battle. Using the skill with this formula unleashes the damage and as a effect, triggers another common event that clears the charged up variable.

Thanks.

2. ### gotnovicksVeteran

Messages:
76
Likes Received:
9
First Language:
Portuguese
Primarily Uses:
N/A
how do I check if the attack was critcal? i want to make a skill that heals then user only if it lands a critcal attack.also, can some one tell ehat's wronge in this formulae?

70 + (70 * Math.min(Math.floor(a.level / 8), 4)) + Math.floor(a.mgk * 0.35)basically, it rises the fixed damage (70) by 70 every 8 levels, in a cap of 70 * 4 plus 35% of users magicka (custom stat I made - and the problem is not in it, 'cause I use it in a simple formulae and it works).

Last edited by a moderator: Dec 9, 2015
3. ### boomyVeteran

Messages:
107
Likes Received:
76
Location:
Melbourne, Australia
First Language:
English
To answer your critical effect question:

So basically a formula of:

if (b.result().critical) {a.gainHp(x); y} else {y}

Should work. It means if the target  is hit by a critical attack (result().critical) then user (a) gains x amount of hp, then apply damage of y; otherwise just apply damage of y. y should be your damage formula.

Last edited by a moderator: Dec 10, 2015
Nuhada likes this.
4. ### GammaVDVeteran

Messages:
70
Likes Received:
3
First Language:
English
I'm trying to do an attack that hits 5 times, each successful hit increase the damage by a multiple of 20 so I have the variable x as

x = 20 + 20 * num_Hits

Where 'num_Hits' would be each successful hit, if the move misses once it should reset back to 'num_Hits = 0', however I'm not sure (a.) how to catch if a hit is successful (b.) how to store it considering the damage formula resets all local variables each time it is called and (c.) how to reset it back to zero after the action completes

Last edited by a moderator: Dec 11, 2015
5. ### KenenVeteran

Messages:
255
Likes Received:
152
First Language:
English
Primarily Uses:
RMMV
Just in case anyone is wondering how to use a specific actor's attributes in a damage formula:

Code:
`\$gameActors.actor(3).agi`

TheRiotInside likes this.
6. ### Myst DesdemonaThe Snark Knight

Messages:
69
Likes Received:
14
Location:
Sweden
First Language:
English/Swedish
I was wondering if anyone can help me with this formula

y = b._actorId === 2 ? 200 && b.gainMp(20) : 100; yI'm using it for an item. If it's actor two, I want it to heal 200 and give mana as well. Although as it stands now, it only gives the mana and zero hp.

If I remove the b.gainMp(20) it works well so I'm guessing I shouldn't write &&.

Thanks in advance.

7. ### Kai MonkeyVeteran

Messages:
166
Likes Received:
117
First Language:
RGSS3
I can't test it in game, but I am 99% sure you just need

b._actorId === 2 ? (b.gainMp(20),200) : 100I tested that in my JS console, and it runs the commands if the condition returns true, and then returns the correct "damage"

Last edited by a moderator: Dec 15, 2015
Myst Desdemona likes this.
8. ### Myst DesdemonaThe Snark Knight

Messages:
69
Likes Received:
14
Location:
Sweden
First Language:
English/Swedish
@Kai monkey. It worked like a charm. Thank you

9. ### BloodletterQChaotic Neutral Assassin

Messages:
1,448
Likes Received:
1,046
Location:
My head's in the clouds at least...
First Language:
English
Primarily Uses:
N/A
I wonder if it's possible to do a Final Fantasy I-III/Bravely Default style of attacking where you can attack multiple times depending on a stat and the number of attacks is reduced going by an enemy's stat. I changed M.DEF to Dexterity so for every 5 points of dexterity over the foe's agility, another hit is added.

10. ### fortellerVeteran

Messages:
105
Likes Received:
17
First Language:
English
So has anyone gotten nested if statements to work correctly?

i want to put this into the proper syntax for it to work as a damage forumula

<damage formula>if (b.hp>b.mhp*0.5){value= b.add_state(83)}else if (b.hp<=b.mhp*0.5&&b.hp>=b.mhp*0.25){ value = a.atk*3.5 }else{value=a.atk*7 } </damage formula>its a spell that buffs you if you have over half hp otherwise heals you if you have between 25% and 50% hp and heals you for even more should you be at less than 25% hp

nvm i got it

Code:
`<damage formula>if (target.hp>target.mhp*0.5){b.addState(83); 0}else if (target.hp<=target.mhp*0.5&&target.hp>=target.mhp*0.25){ value = user.atk*3.5;}else{value = user.atk*7;}</damage formula>`

Last edited by a moderator: Dec 16, 2015
11. ### ColumnVeteran

Messages:
80
Likes Received:
20
First Language:
Engrish
Let me get some critique on this idea please, because it's the one I'm planning on using for my game. I'm using a shadow hearts-esque system for my attacks (sand the judgement ring, sorry ring spirit) where each characters "default" attack hit multiple times, ranging from 2 to 4 times. Anyways, here's the formula of which is speak.

A.atk * .50 - b.def * .25 (4 hits) for melee characters

A.atk * .66 - b.def * .33 (3 hits) for balanced characters

A.atk * - b.def * .5 (2 hits) for less physical characters

But then have the actual attack hit 4, 3 or 2 times, so it'd basically be a.atk * 2 - b.def but broken up into multiple pieces. So a character with 50 strength attack an enemy with 30 defense would do 40ish damage, divide into four hits. Yea? How terrible of an idea is this?

12. ### NuhadaVillager

Messages:
27
Likes Received:
14
First Language:
French
In theory it's a good idea but you can't change the number of hits via the damage foruma box. Because the damage formula box is the damages that each of the hits make.

Maybe you can trick this with a forced action in the damage formula box, but i don't know how it works for that.

13. ### ColumnVeteran

Messages:
80
Likes Received:
20
First Language:
Engrish
Hm. True. Dang. I believe Yanfly had a script for vx ace that allowed you to edit all the battle screen commands, meaning you could change or even remove "attack".. I used that to make all my characers default "attacks" actually different skills, implementing the above formula. I guess I wasn't thinking that I don't have the capacity to do that yet. Dang. Guess I'll just poke around until something like that comes out for MV. Poo.

I love these kinds of threads. One of my favorite things to do when I start playing a new rpg is to look up how all the formulas work. It started back when I played ff12 I think. Ever since then, I love going through the numbers, learning exactly how things work.

14. ### NuhadaVillager

Messages:
27
Likes Received:
14
First Language:
French
There is already some plugins for that, you should check it out

http://himeworks.com/2015/12/actor-battle-commands/

http://himeworks.com/2015/12/battle-command-use-skill/

15. ### ColumnVeteran

Messages:
80
Likes Received:
20
First Language:
Engrish
I think those are exactly what I'm looking for! Thanks Nuhada! (And thank you Hime Works as well!)

16. ### CodelessVillager

Messages:
6
Likes Received:
0
Location:
BSAS, Argentina
First Language:
Español
Primarily Uses:
RMMV
Hello there! I have a problem :/
This...

When i change the "1000%" for any number under 100% make the Maker Crash :/
Anybody knows how to fix it?

PD: Sorry for my bad english
PD2: Sorry if is not here where i should put this :c

Last edited by a moderator: Dec 17, 2015
17. ### a6pVeteran

Messages:
30
Likes Received:
8
Location:
Canada
First Language:
English
How would I use the formula to make a skill that increases in power for each successful strike? I tried a formula like this:

a.isStateAffected(15) ? x = a.atk * 7 - b.def * 2: a.isStateAffected(14) ? x = a.addState(15), a.atk * 5 - b.def * 1.75: a.isStateAffected(13) ? x = a.addState(14), a.atk * 3 - b.def * 1.5: x = a.atk * 2 - b.def * 1.25 ; x * (1 + (a.level - b.level)/25)

but this doesn't work.

Last edited by a moderator: Dec 18, 2015
18. ### SmelipandaVeteran

Messages:
40
Likes Received:
35
Location:
Wisconsin
First Language:
English
It sounds like this would be better to use a variable for this skill and less adding states over and over again, which is what i believe you are doing. Someone else will have to way in as I dont know if there is a way to determine in the damage formula to see if an attack was a successful hit or not.

19. ### a6pVeteran

Messages:
30
Likes Received:
8
Location:
Canada
First Language:
English
Good idea, should've thought of that. At least I came up with a new type of skill because of it.

Does anyone know if there's some sort of master list of battle formula commands?

20. ### brendonxVeteran

Messages:
85
Likes Received:
5
Location:
Australia
First Language:
English
I'd also love to know if there is a big list of formula commands!