RMMV Damage Formula - ideas and help

MikeMakes

Veteran
Veteran
Joined
Sep 30, 2015
Messages
184
Reaction score
46
First Language
English
Primarily Uses
@saikais: I'm having the same problem, too. I am doing some balancing and keeping defense stat low for now until I think up of something. Maybe keep a low modifier like 1.5 for the attacker's attack?

I am also wondering is there a syntax to do the following:

add states 2 through 5
 
Last edited by a moderator:
Joined
Jan 23, 2014
Messages
159
Reaction score
19
First Language
English
Oh yes.  I've yet to do too much with it, but I wrote a somewhat complicated looking formula:

JahwsUF.Utils.logScaleDamage = function(atk, def) { return atk * Math.log10(atk) * Math.log(1 + Math.pow((atk / def), 2)) / Math.log(2);}It's surely not a perfect match, but it's designed to do damage scaling similar to that from the Final Fantasies - it's not subtractive in the slightest.  You could take the formula (the contents of the line after "return") and put that in the formula box directly, but I'm planning to use this core function so often I made it in a plugin so all my formulas can reference it and then modify potency after the base calculation (like Pokemon does).
Hi, I was curious on how you would call that in the Damage Formula box. (also how to set that up as a plug-in so I can call it. I don't know Javascript quite yet and would like some guidance. Thanks!
 

ChaoticShadow24

The Most Chaotic
Veteran
Joined
Dec 15, 2013
Messages
186
Reaction score
6
First Language
English
Primarily Uses
Can someone please tell me how the 100 + thing works?

For example: 100 + a.mat * 2 - b.mdf * 2

From my limited understanding of this, it's saying 2 x User's Magic Attack -minus- Opponents Magic Defence ... x2?

So...

If you had 50 Magic Attack, x 2 would equal 100 Magic attack? Then the game would deduct whatever 100 Magic Attack equals in damage to the opponent?

I'm still not sure about it, and I don't know what the 100 + part means.

Thanks!

Please explain it in the easiest way possible.
 

MikeMakes

Veteran
Veteran
Joined
Sep 30, 2015
Messages
184
Reaction score
46
First Language
English
Primarily Uses
I think the "100 +" ensures a minimum damage of 100 no matter what (to be affected by variance, elemental rate, and critical rate).

That's because if the Attacker and Target's stats are exactly the same, they will cancel out to zero.

e.g. 100 + (50*2) - (50*2) = 100
 
Last edited by a moderator:

luigiman2201

Villager
Member
Joined
Oct 30, 2015
Messages
16
Reaction score
2
First Language
English
Can someone please tell me how the 100 + thing works?

For example: 100 + a.mat * 2 - b.mdf * 2

From my limited understanding of this, it's saying 2 x User's Magic Attack -minus- Opponents Magic Defence ... x2?

So...

If you had 50 Magic Attack, x 2 would equal 100 Magic attack? Then the game would deduct whatever 100 Magic Attack equals in damage to the opponent?

I'm still not sure about it, and I don't know what the 100 + part means.

Thanks!

Please explain it in the easiest way possible.
The 100 + just adds 100 damage flat. some examples:

user has 50 mat (magic attack), opponent has 20 mdf (magic defense)

100 + a.mat * 2 - b.mdf * 2With the order of operations (multiplying goes before subtracting or adding), this example gives:

100 + 50 * 2 - 20 * 2
Code:
100 + 100 - 40 = 160 Damage
Another example:

User's mat = 65, Target's mdf = 77

100 + a.mat * 2 - b.mdf * 2
Code:
100 + 65 * 2 - 77 * 2
Code:
100 + 130 - 144 = 87 Damage
Let me know if there's anything you don't understand, and i'll try to explain
 
Last edited by a moderator:

Zarsla

Veteran
Veteran
Joined
Jan 23, 2015
Messages
710
Reaction score
227
First Language
English
Primarily Uses
I'm trying to have my attack skill have different formulas depending on the class. 1 class uses both mat & atk, another uses mat and the other is atk. I've tried doing it by using this:

a._classID === 1 ? a.atk + a.mat - b.def + b.mdf : a._classID ==== 2 ? a.atk * 4 - b.def * 2 : a._classID === 3 ? a.mat * 4 - b.mdf : 0

but I keep getting a syntax error it says unexpected syntax token *
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,603
First Language
English
Primarily Uses
RMMV
You have an extra = in there for the second comparison, but I suspect that's just a typo.


Try this:

a._classId === 1 ? (a.atk + a.mat - b.def + b.mdf) : a._classId === 2 ? (a.atk * 4 - b.def * 2) : a._classId === 3 ? (a.mat * 4 - b.mdf) : 0The only difference I've made there is to fix the ==== and to put some brackets around things. It seems to work okay for me.
If that doesn't work, let us know how you're testing, and where it's saying that error message (because by default you don't see a message if you have an error in the damage formula - it just defaults to 0).


Two other potential issues with this ...


- if you're modifying the Attack skill (skill #1), be aware that enemies use it too, and enemies don't have classes, so they will always hit for 0


- I'm not sure if you intend to + b.mdf in that first condition - if you want to start with the actor's atk and mat, and then take away the enemy's def and mdf, you would need to do one of the following:


a.atk + a.mat - b.def - b.mdf


a.atk + a.mat - (b.def + b.mdf)


Otherwise you're taking away their def but adding back their mdf
 

Zarsla

Veteran
Veteran
Joined
Jan 23, 2015
Messages
710
Reaction score
227
First Language
English
Primarily Uses
@Shaz Thanx, I relized that there was a syntax error I kept writing classId as classID, where I should have written as classId.

So it seems syntax error unexpected token * means you've typed/wrote the forumula/scripting incorrectly.
 

Jeffafa

Multi-colored Mage
Veteran
Joined
May 25, 2012
Messages
42
Reaction score
1
First Language
English
Primarily Uses
So damage formulas and map designing are my two biggest weaknesses when it comes to this program. And reading through this topic makes me feel even more inept at damage formulas lol.

I honestly have no idea where to even start. I know I want the game to begin with low damage, and end with high damage; magic casters being able to deal ~20,000 damage (with their stats/equipment pushed to the absolute max). Ideally it would hover around the traditional 9999 near end-game with average stats/gear, though that's not a make-or-break thing for me.

I haven't even begun to start working on stats for characters/enemies though, so should I seek help working on that first? Or should I figure out a base formula that I can work with and mold everything else around that?

I started a project a few years ago in which I was just using existing stats and damage formulas from other games, like Final Fantasy. I don't want to do that though. It feels low and I don't want to risk any trouble or anything for using data from something else.

(Also, I didn't know if I should post this here since a ton of people are working out various formulas already, or create a new topic. So I apologize if I should have done the latter.)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,966
Reaction score
13,603
First Language
English
Primarily Uses
RMMV
This is not about damage formulas. This is about setting your enemy stats and your actor stat progression. Please do create a new topic. This thread is JUST for the damage formula box on skills and items.
 

Jeffafa

Multi-colored Mage
Veteran
Joined
May 25, 2012
Messages
42
Reaction score
1
First Language
English
Primarily Uses
This is not about damage formulas. This is about setting your enemy stats and your actor stat progression. Please do create a new topic. This thread is JUST for the damage formula box on skills and items.
Gotcha. I apologize. I do very much need damage formula assistance, but I suppose the stats will have to come first. Thanks.
 

RockEsper

Villager
Member
Joined
Jul 10, 2012
Messages
19
Reaction score
6
First Language
English
I'm trying to make a damage formula that deals x1 damage if the user's luck is at least 10, x2 damage if 20, x3 damage if 30, and x4 damage if 40+. And it should go no higher than x4, even if luck is 50 or more.

Would it be something like, damage * floor(a.luk / 10)? Not sure if that's how to use floor, and it doesn't cover the x4 cap.

Please help? :D
 
Last edited by a moderator:

VHStapes

Game Designer
Veteran
Joined
May 25, 2014
Messages
57
Reaction score
7
First Language
English
I'm trying to make a damage formula that deals x1 damage if the user's luck is at least 10, x2 damage if 20, x3 damage if 30, and x4 damage if 40+. And it should go no higher than x4, even if luck is 50 or more.

Would it be something like, damage * floor(a.luk / 10)? Not sure if that's how to use floor, and it doesn't cover the x4 cap.

Please help? :D
Lots of edits, here's the best solution, I think.

Code:
if (a.luk > 9) {x = Math.min(Math.max(Math.floor(a.luk / 10), 1), 4)} else {x = 0}; a.atk * x - b.def
 
Last edited by a moderator:

RockEsper

Villager
Member
Joined
Jul 10, 2012
Messages
19
Reaction score
6
First Language
English
Lots of edits, here's the best solution, I think.

if (a.luk > 9) {x = Math.min(Math.max(Math.floor(a.luk / 10), 1), 4)} else {x = 0}; a.atk * x - b.def
Oh, well thanks to you now I understand if statements, so I think this would work and be simpler...?

Code:
if (a.luk > 40) {x = 4} else {x = Math.floor(a.luk / 10)}; a.atk * x - b.def
 
Last edited by a moderator:
Joined
Jan 23, 2014
Messages
159
Reaction score
19
First Language
English
Hi, I was curious on how you would call that in the Damage Formula box. (also how to set that up as a plug-in so I can call it. I don't know Javascript quite yet and would like some guidance. Thanks!
Still curious on the set up for a plugin call for custom damage formula. Much appreciated.
 

VHStapes

Game Designer
Veteran
Joined
May 25, 2014
Messages
57
Reaction score
7
First Language
English
Oh, well thanks to you now I understand if statements, so I think this would work and be simpler...?

if (a.luk > 40) {x = 4} else {x = Math.floor(a.luk / 10)}; a.atk * x - b.def
In your original post you said you wanted them to do 1x damage only if they had at least 10 luck, so mine accommodates for that, but otherwise yes yours is better.

Ifs are super cool! Here's a quick mock-up else/if statement, just for reference, because they are also really useful.

if (argument) {do this} else if (different argument) {do this} else {do this}You can keep chaining the "else ifs" as many times as you need, as long as you end it with a plain "else" eventually.
 

Chaos Avian

Abyssal Wing
Restaff
Joined
Jul 16, 2012
Messages
3,230
Reaction score
785
First Language
English
Primarily Uses
I have a skill that does damage based on the difference between the max HP and current HP of the party, what damage formula would I use to achieve this?
 

Vanguard

Villager
Member
Joined
Oct 16, 2012
Messages
25
Reaction score
5
First Language
English
Primarily Uses
I have a small numbers damage that i use from ace and it seems to work in mv just as well. 0 + a.atk * 0.5 - b.def * 0.3, if you have guys starting at 30 to 50 hp this works well enough for me. the magic damage I really haven't played with yet.
 

Merancapeman

Veteran
Veteran
Joined
Jun 9, 2013
Messages
39
Reaction score
17
First Language
English
I can't wait for there to be a better explanation of the formulaic system, such as what is and isn't allowed, or what terms do what. For instance, I sat here and tried to figure out a Huskar-esque (DOTA2 character) attack would look like in terms of a.atk * 4 + (a.hp {divided? no idea what sign you use}/2) - .... Ok, so basically what I'm trying to say is user's attack times four (like a normal attack) plus the user's current hp divided by two, subracted by the regular physical attack defense.

Not so sure how to achieve that... Or what all the terms are.
 

Bob423

Warper
Member
Joined
Nov 13, 2015
Messages
2
Reaction score
0
First Language
English
How is the critical hit rate percentage (and other percentage based parameters) handled in code? I'm assuming 25% = 0.25, but I'd like to make sure and I'm not sure where to find out.
 

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

Latest Threads

Latest Profile Posts

Officially not a mod anymore. Thanks for the many years!
Thinking if i should post on the classifieds section...
Made another plugin showcase video! :kaojoy:
(Plugins and details inside the description of the YouTube video.) :LZScheeze:
Ami
Castle is my Biggest Fear :kaodes:. I just Managed make Part by Part (like the Entrance only),not the Entire Castle like in the RM Sample...
This video really speaks to me...

Forum statistics

Threads
104,374
Messages
1,005,910
Members
135,894
Latest member
EnriX
Top