RMMV Damage Formula - ideas and help

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,107
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
Instead of adding state 1, just make the damage be equal to b.hp so it removes all their HP, which in turn will add the state. See if you still get the errors then.
 

Rukiri

I like to make Action-RPGs
Veteran
Joined
Jan 20, 2014
Messages
843
Reaction score
513
First Language
English
Primarily Uses
Other
a.bp + a.str / a.stamina + (rand(4) + 1 * a.pow) - b.def / b.stamina   
 

emelian65

Veteran
Veteran
Joined
Sep 13, 2015
Messages
190
Reaction score
50
First Language
Spanish
Primarily Uses
Instead of adding state 1, just make the damage be equal to b.hp so it removes all their HP, which in turn will add the state. See if you still get the errors then.
Well that's a way to get around th problem I suppose, but why the problem appears in the first place, I wonder if it's only with State 1 mmm I'll have to test it, anyway thnak you for the advice, BTW i have already test it it works of course things like elemental propieties and the % variance on the skill affect it so well, that's it I'll have to modify some formulas

Thank you very much for the advice
 

Column

Veteran
Veteran
Joined
Dec 11, 2015
Messages
80
Reaction score
20
First Language
Engrish
I'm such a dunce.. I just realized I can use / to divide in forumlas. Derp derp.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,107
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
Well that's a way to get around th problem I suppose, but why the problem appears in the first place, I wonder if it's only with State 1 mmm I'll have to test it, anyway thnak you for the advice, BTW i have already test it it works of course things like elemental propieties and the % variance on the skill affect it so well, that's it I'll have to modify some formulas


Thank you very much for the advice
Did you try it and did it solve the problem? If so, the error probably happened in the first place because you were going about killing the enemy in the wrong way. If the engine is set up to do A, B then C, and you go straight to C, you could be missing out on some important steps, and things couldn't be expected to work correctly.


If you've tried the above and the problem still happens, we'll have to keep looking. And in that case, I'd ask what plugins you're using and if the problem still happens when you disable them all (or try to do the same thing in a brand new project with no plugins).
 

Backwardskey

Phones
Veteran
Joined
Dec 22, 2015
Messages
39
Reaction score
13
First Language
English
Primarily Uses
RMMV
Hey, guys. I made a thread on this to no avail - is there not a way to find the base stats of the actor? I'm attempting to use the base ATK of a character, as in, their base ATK with nothing equipped, and the ATK bonus of the weapon they're using itself (which I suppose I could use by subtracting the base from the total) inside a damage formula, which looks like so:

(ATK - b.def) * (1 + STR * (a.level+STR)/256)

ATK = equipped weapon's attack bonus

STR = user's base attack

I saw in the thread somewhere that it's no longer possible to do, although Ace had a method for it..is there no MV equivalent?
 

a6p

Veteran
Veteran
Joined
Nov 1, 2015
Messages
30
Reaction score
8
First Language
English
Hey, guys. I made a thread on this to no avail - is there not a way to find the base stats of the actor? I'm attempting to use the base ATK of a character, as in, their base ATK with nothing equipped, and the ATK bonus of the weapon they're using itself (which I suppose I could use by subtracting the base from the total) inside a damage formula, which looks like so:

(ATK - b.def) * (1 + STR * (a.level+STR)/256)

ATK = equipped weapon's attack bonus

STR = user's base attack

I saw in the thread somewhere that it's no longer possible to do, although Ace had a method for it..is there no MV equivalent?
For a base stat without equipment: 

paramBase(#)Where # =

0 Max HP

1 Max MP

2 Attack

3 Defense

4 Magic Attack

5 Magic Defense

6 Agility

7 Luck

So the formula you're looking for is:

((a.atk - a.paramBase(2)) - b.def) * (1 + a.paramBase(2) * (a.level + a.paramBase(2))/256)Remember that formulas are case sensitive!

 

Instead of adding state 1, just make the damage be equal to b.hp so it removes all their HP, which in turn will add the state. See if you still get the errors then.
Did you try it and did it solve the problem? If so, the error probably happened in the first place because you were going about killing the enemy in the wrong way. If the engine is set up to do A, B then C, and you go straight to C, you could be missing out on some important steps, and things couldn't be expected to work correctly.

If you've tried the above and the problem still happens, we'll have to keep looking. And in that case, I'd ask what plugins you're using and if the problem still happens when you disable them all (or try to do the same thing in a brand new project with no plugins).

 
While this works, it doesn't distinquish enemies like boss monsters who you may want to have immunity to this effect. I also experience a problem when using addState(1) in my formula, but instead of my game crashing, it just does 0 damage, and continues to do 0 damage every turn like it's a status effect.
 
Last edited by a moderator:

GammaVD

Veteran
Veteran
Joined
Oct 29, 2015
Messages
70
Reaction score
3
First Language
English
I've played around with adding state 1 (Knocked Out) before, the game won't let you add it to anything, instead it forces it when a actor or enemy has 0 HP (unless you have immunity to that state and hence can never die)

Two ways round this problem are 1: b.hp [this deals damage equal to the targets current hp making then have zero; it means you will get the damage pop up though]

2: via a second state that uses a script to trigger state 1 (ie. instant death) this is likely the better option since you won't get the pop up and can make characters immune to this state

If you want to make the script yourself it is actually an easy one to do
 

emelian65

Veteran
Veteran
Joined
Sep 13, 2015
Messages
190
Reaction score
50
First Language
Spanish
Primarily Uses
I remeber using this from a VXAce post in this forum, it's basically a Skill that drains both Hp and Mp, I haven't tried it directly in MV because I seriously have no idea on what am I doing so

d = (formula); b.result.mp_damage = d; d

How will you transform this to MV?
 

TheRiotInside

Extra Ordinaire
Veteran
Joined
Sep 3, 2012
Messages
270
Reaction score
123
First Language
English
Primarily Uses
@emelian65

Try this :)

d = 20 ; b.gainMp(-d) ; d
(where 20 is your damage formula)
 

emelian65

Veteran
Veteran
Joined
Sep 13, 2015
Messages
190
Reaction score
50
First Language
Spanish
Primarily Uses
@emelian65

Try this :)

d = 20 ; b.gainMp(-d) ; d(where 20 is your damage formula)
Mmm how will I explain mmm it drains Hp but it doesn't seem to drain Mp

So I decided to add one more step into the formula

d = 50 + a.mat * 2 - b.mdf * 2 ; b.gainMp(-d) ; a.gainMp(d) ; d Now it drains both HP and MP as long as the damage type is set to Drain HP, saddly MP doesn't seem to be affected by variance which makes it alway damage and recover a flat number of MP, what should I add to the d formula so it gains a variance let's say of 30%?
 
Last edited by a moderator:

a6p

Veteran
Veteran
Joined
Nov 1, 2015
Messages
30
Reaction score
8
First Language
English
Mmm how will I explain mmm it drains Hp but it doesn't seem to drain Mp

So I decided to add one more step into the formula

d = 50 + a.mat * 2 - b.mdf * 2 ; b.gainMp(-d) ; a.gainMp(d) ; d Now it drains both HP and MP as long as the damage type is set to Drain HP, saddly MP doesn't seem to be affected by variance which makes it alway damage and recover a flat number of MP, what should I add to the d formula so it gains a variance let's say of 30%?
Try this:

d = Math.randomInt((50 + a.mat * 2 - b.mdf * 2)*0.7, (50 + a.mat * 2 - b.mdf * 2)*1.3); a.gainMp(Math.min(b.mp, d)); b.gainMp(-d); dIf you want your HP and MP damage to be exactly the same, set your variance to 0%. Otherwise you can leave it to the default 20% if you like.

I added the Math.min() command because it returns the smallest value. So if you deal more MP damage than the enemy has, you will only gain the remaining amount. To do this I also had to place the a.gainMP before the b.gainMP, because it would otherwise return a value after the mp was damaged.

I also added the Math.randomInt() command which returns a random integer between the two values. Careful about using this command because if you divide or multiply the command it may return a decimal, which for some reason shows up as a decimal in the actual game (with a space instead of a decimal point), as shown here:



The formula I provided should return correct integers, though.
 
Last edited by a moderator:

emelian65

Veteran
Veteran
Joined
Sep 13, 2015
Messages
190
Reaction score
50
First Language
Spanish
Primarily Uses
Try this:

d = Math.randomInt((50 + a.mat * 2 - b.mdf * 2)*0.7, (50 + a.mat * 2 - b.mdf * 2)*1.3); a.gainMp(Math.min(b.mp, d)); b.gainMp(-d); dIf you want your HP and MP damage to be exactly the same, set your variance to 0%. Otherwise you can leave it to the default 20% if you like.

I added the Math.min() command because it returns the smallest value. So if you deal more MP damage than the enemy has, you will only gain the remaining amount. To do this I also had to place the a.gainMP before the b.gainMP, because it would otherwise return a value after the mp was damaged.

I also added the Math.randomInt() command which returns a random integer between the two values. Careful about using this command because if you divide or multiply the command it may return a decimal, which for some reason shows up as a decimal in the actual game (with a space instead of a decimal point), as shown here:

The formula I provided should return correct integers, though.
it works more or less the Mp damage now varies, however it seem to be able to varie as low as 1 however it doesn't seem to pass the maximun value of the damage formula however. The Hp doesn't as I change the formula to this to make it a little more real to the numbers of my game.

d = Math.randomInt(75 + a.mat * 4 - b.mdf * 2 * 0.8 , 75 + a.mat * 4 - b.mdf * 2 * 1.2) ; a.gainMp(Math.min(b.mp, d)); b.gainMp(-d); 75 + a.mat * 4 - b.mdf * 2
 
Last edited by a moderator:

Smelipanda

Veteran
Veteran
Joined
Oct 25, 2015
Messages
40
Reaction score
37
First Language
English
For those that dont want to have to scroll through all 18 pages to find something (and the search button is to much work) look no FURTHER! I have compiled a huge amount of all the commands in this forum on a spreadsheet! It is paired with my yanfly script calls but at the bottom there is a 2nd tab for "Damage Form". I hope this helps people find the answer to your question. And if people know other things that should be added, as i dont know much javascript, message me and i will get it added! Link for the spreadsheet is 

https://goo.gl/YI3Ucy
 
Last edited by a moderator:

a6p

Veteran
Veteran
Joined
Nov 1, 2015
Messages
30
Reaction score
8
First Language
English
it works more or less the Mp damage now varies, however it seem to be able to varie as low as 1 however it doesn't seem to pass the maximun value of the damage formula however. The Hp doesn't as I change the formula to this to make it a little more real to the numbers of my game.

d = Math.randomInt(75 + a.mat * 4 - b.mdf * 2 * 0.8 , 75 + a.mat * 4 - b.mdf * 2 * 1.2) ; a.gainMp(Math.min(b.mp, d)); b.gainMp(-d); 75 + a.mat * 4 - b.mdf * 2
Sorry, I didn't realize that randomInt(x) didn't have a min and max value. It'll always be between 0 and the first number you put in. Since Math.randomInt(x) is pretty unreliable to use anyways, you're better off using Math.round(x).

Try this formula instead. Oh, and don't remove the parentheses this time, they're very important. You'd be messing up the order of operations for the math (BEDMAS) so they won't give you the right variance you're looking for.

d = Math.round((75 + a.mat * 4 - b.mdf * 2) * 1.2 - Math.random() * (75 + a.mat * 4 - b.mdf * 2) * 0.4); a.gainMp(Math.min(b.mp, d)); b.gainMp(-d); 75 + a.mat * 4 - b.mdf * 2I switched up the formula a bit.

Math.round(x) will round the formula to the nearest integer. This is important when using Math.random(), which will almost always return a decimal.

Math.random() will return a random number between 0 and (1-1/∞). So it can return 0, but it will never result in 1. As far as I know you can't put anything in the brackets or it'll stop functioning.
 
Joined
Dec 26, 2015
Messages
4
Reaction score
0
First Language
English
Hey folks! I’m in the process of trying to create a skill which inflicts a state on all enemies only if the user is already afflicted with that same state. Any clue how to implement this using a damage formula? I figure it should be simple to work out, but I’m having trouble. x_x
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,107
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
Hey folks! I’m in the process of trying to create a skill which inflicts a state on all enemies only if the user is already afflicted with that same state. Any clue how to implement this using a damage formula? I figure it should be simple to work out, but I’m having trouble. x_x
If your state is 15, as an example, you would do this:

a.isStateAffected(15) ? b.addState(15) : null; 0replacing the 0 with the damage formula.
This also assumes if you want to inflict the state on ALL enemies, that the skill's target is All Enemies.
 
Joined
Dec 26, 2015
Messages
4
Reaction score
0
First Language
English
If your state is 15, as an example, you would do this:

a.isStateAffected(15) ? b.addState(15) : null; 0replacing the 0 with the damage formula.This also assumes if you want to inflict the state on ALL enemies, that the skill's target is All Enemies.
Thank you so much for your timely response! This works great.
 

Pine Towers

Knight Hospitaller
Veteran
Joined
Nov 11, 2015
Messages
467
Reaction score
226
First Language
Portuguese
Primarily Uses
RMMV
For a base stat without equipment: 

paramBase(#)Where # =

0 Max HP

1 Max MP

2 Attack

3 Defense

4 Magic Attack

5 Magic Defense

6 Agility

7 Luck

So the formula you're looking for is:

((a.atk - a.paramBase(2)) - b.def) * (1 + a.paramBase(2) * (a.level + a.paramBase(2))/256)Remember that formulas are case sensitive!

 

 

While this works, it doesn't distinquish enemies like boss monsters who you may want to have immunity to this effect. I also experience a problem when using addState(1) in my formula, but instead of my game crashing, it just does 0 damage, and continues to do 0 damage every turn like it's a status effect.
Not the one, but thank you on your answer. Is it possible to do the inverse? Get the "a.WeaponAttack" without the a."base"attack? This is because in my damage formula a.atk defines hit chance and "a.WeaponAttack" gets the damage.

Try this:

(Math.randomInt(20) + a.atk) > (Math.randomInt(20) + b.def) ? a.matk : 0

I think the issue is that you're using lots of ; instead of {} in your if/then/else test. Also, 0 is what's returned if you have an error in your formula.

The above removes the need for the temporary variables and makes it shorter.

Note that Math.randomInt gives a number between 0 and 19, not between 1 and 20, but for these purposes it doesn't really matter, as it's doing it for both sides.
On a second question, is it possible to call Miss/Evade on the damage formula? Like ? a.matk : Miss/Evade, so to avoid too many 0s during battle?
 
Last edited by a moderator:

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

Latest Threads

Latest Posts

Latest Profile Posts

Frostorm wrote on Featherbrain's profile.
Hey, so what species are your raptors? Any of these?
... so here's my main characters running around inside "Headspace", a place people use as a safe place away from anxious/panic related thinking.
Stream will be live shortly! I will be doing some music tonight! Feel free to drop by!
Made transition effects for going inside or outside using zoom, pixi filter, and a shutter effect
I have gathered enough feedback from a few selected people. But it is still available if you want to sign up https://forums.rpgmakerweb.com/index.php?threads/looking-for-testers-a-closed-tech-demo.130774/

Forum statistics

Threads
105,992
Messages
1,018,195
Members
137,773
Latest member
Kirakirna
Top