Glasses

Damage Formulas 101 (MV Edition)

32 posts in this topic

Thanks for this info, it really is useful. 

 

Now for my request  ;)

 

How would one use JUST the weapon Attack parameter in a formula. I hunted and found 'weapons.at(0).params.at(0)' by my attempt to alter the numbers, add a.weapons.at(0).params.at(0) to it and such yielded nada.... help me out, again?

Example: Guns do flat damage, so attacking with a pistol atk=25, I want it to deal 25 (plus variation) damage, not the total of the actors attack value.

Ideally, I would compare this value to the defenders armor defense, so it is only blocked by armor, not all the defense thats been built up....cuz bullets

 

EDIT: Got, used the paramBase to get the base attack, then just subtracted that from the Full Attack, giving me my result....

not pretty but it will work

Edited by SirCumferance

Share this post


Link to post
Share on other sites

Awesome guide it has helped me with a lot of things, but i wondering how to have multiple formulas and get them to work?

Like lets say I have a skill thats gets more powerful depending upon a variable. So as the variable increases the skills damage, hit rate, and critical become more powerful, as well as any other effects that I might want to add like a staff the increases my mana and boosts my fire resistance to fire depending on my level of a certain variable.

I've been trying various combinations of formulas and while I can get them all to work individually, they wont work when I put them all in the formula box.

Edited by Wickednick

Share this post


Link to post
Share on other sites

not sure if this is the right place for this question but I hope you can help. I was wanting to modify the damage formula to check armor type ie, cloth 1, leather 2, chain 3, or plate 4 and have a different cap on the armor the user or target could use. I tried to write a plugin for this but was having a hard time finding the part for the damage formula.  I was wondering if I could use like Yanfly's battle engine to use <setup action> code</setup action> to load this defensive code before damage is calculated, or is there a better way about going about this? Once I can figure out this step I can then reverse it and do the user.mdf as well. 

 

if ((hasArmor(etypeID) === 1) && (user.def >= 100))
Math.round((user.def - 100) * .25 + 100);
if ((hasArmor(etypeID) === 2) && (user.def >= 125))
Math.round((user.def - 125) * .5 + 125);
if ((hasArmor(etypeID) ==== 3) && (user.def >= 150))
Math.round((user.def - 150) * .75 + 150);
if ((hasArmor(etypeID) === 4) && (user.def >= 200))
Math.round((user.def - 200) * 1.1 + 200); 

Share this post


Link to post
Share on other sites

 

not sure if this is the right place for this question but I hope you can help. I was wanting to modify the damage formula to check armor type ie, cloth 1, leather 2, chain 3, or plate 4 and have a different cap on the armor the user or target could use. I tried to write a plugin for this but was having a hard time finding the part for the damage formula.  I was wondering if I could use like Yanfly's battle engine to use <setup action> code</setup action> to load this defensive code before damage is calculated, or is there a better way about going about this? Once I can figure out this step I can then reverse it and do the user.mdf as well. 

 

if ((hasArmor(etypeID) === 1) && (user.def >= 100))
Math.round((user.def - 100) * .25 + 100);
if ((hasArmor(etypeID) === 2) && (user.def >= 125))
Math.round((user.def - 125) * .5 + 125);
if ((hasArmor(etypeID) ==== 3) && (user.def >= 150))
Math.round((user.def - 150) * .75 + 150);
if ((hasArmor(etypeID) === 4) && (user.def >= 200))
Math.round((user.def - 200) * 1.1 + 200); 

 

I think you may have answered your own question, you could use the ID as a multiplier? I cannot code or anything, so forgive my amateurness. If you are wearing Armor ID 2, multiply it the Defense value by (Armor.ID*.25) or some such, so you only need to really do it the once....

 

Looking at it, it made more sense in my head, lol

Share this post


Link to post
Share on other sites

Hello Glasses! Hello everyone!

First of all, great tutorial! I enjoyed a lot and only logged in because of it. I`m already using lots of things from it!

So I need help with some formulas I`m messing with!

I`m doing a game where skills should evolve according to the number of times the player uses them - practice. The more he uses them, after a threshold, the more the skills improve. Example: blessed hands heals 50 HP and costs 10 MP; but if you use it 15 times, it evolves to heal 75 HP and costing 21 MP. I`m trying to do so with the following damage formula and a common event running in parallel:

 

v[10] +1; a.addstate(0010)

 

if (v[10] >= 30)

    if (v[10]<70)

        change skill: {hero}, - blessed hands 1

        change skill: {hero}, +blessed hands 2


The added state is just to give the skill user a cooldown on the skill - so the player may not spam heals or overpowered skills. The v[10]+1 is supposed to increase the value stored in the variable "blessed hands" by one (increment it). Should it be v[10]+=1, like in C language?

I suspect yes since .js is very similar to C. I know it seems stupid, just clearing out some doubts.

I`m not sure about the common event either: I can`t put to check if a specific hero has learned the skill already because the player can choose between 18 actors and then between 8 classes that which has its own skills...

Another thing. I`m also creating a skill called "Precision attack", which is for the hunter... but I can`t seem to be doing it right:

v[120]+1; a.addstate(0133); a.atk * 4 - b.def * 2

 

The a.add_state here is a state that increases hit and crit chance before the attack. However, I have expermented it and it always damages 0 no matter what. It seems not to be the first line of the formula since that with other skills this is not a problem - and since the normal atacck on the same circumstances does damage. The state adding ins`t doing it either, and I checked the enemy and actor`s atk and def to see if that was a problem, <i>nope</i>. The only thing that solves is taking the "a.add_state(0133);" part out, and that`s undesirable because of the skill feats it produces...

So I wondered: how to put that increase in hit chance and crit chance in the formula?

I tried replacing the "a.addstate(0133);"  the following:

a.sethit(a.hit+25); a.setcri(a.cri+50);

Din`t work. So I tried this, considering another syntax:

a.hit*1.25; a.cri*1.5;

Meh. So I tought I had it with:

a.cri(1.5);

 

But nooo... Q_Q How do I do it? Ofc the increment to the variable has to be there and the damage too.

 

Edit: discovered that the programming language in RPG Maker MV is case-sensitive. Eh. Also, to count the amount of times a skill is used, it is best to add a common event to do that for you.

Edited by Daniel Campos

Share this post


Link to post
Share on other sites
On 15/12/2015 at 11:54 AM, Glasses said:

(!b.isStateAffected(10)) b.addState(10); 100

Would swapping these around work?

 

!b.addState(15)) b.isStateAffected(15) ? 999999 : 0

 

 

would this work and if a enemy is resistant to the state would it fail to add the state?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.