# Damage Formulas 101

#### ATT_Turan

##### Forewarner of the Black Wind
Edit: removed because I found a more active thread to ask the same question, as this one appears to have been dead a while
Just as a suggestion, there's not much reason to do that. Recent/unread posts show up in the same lists on the site. So unless there's someone who's only working off of notifications from threads they've Followed, we're going to see your post regardless of which specific damage formula thread it's in

#### emelian65

##### Veteran
Theorically, making a check for more than one condition would work with && on it right?

For example:

JavaScript:
``a.mp && a.tp >= 35 ? 75 : 40;``

Could this work if I need the skill to deal extra damage as long as MP and TP are above 35? Or should I need to do something else?

#### ATT_Turan

##### Forewarner of the Black Wind
Theorically, making a check for more than one condition would work with && on it right?
No, that's not correct JavaScript syntax. Each side of the boolean operator must be a complete comparison. See:

So you'd do `a.mp>=35 && a.tp>=35`

#### Fonixed

##### Veteran
I'm not receiving any battle damage with this formula I'm not sure why.
Can this be done or do I need to make two different damage formulas with the same name?
JavaScript:
``if (a.actorId() === 1) { (v[1] + a.atk * 4 - b.def * 2); } else { (a.atk * 4 - b.def * 2); }``

#### Shaz

##### Keeper of the Nuts
@Fonixed, try == instead of ===. What's in variable 1?

#### Fonixed

##### Veteran
@Fonixed, try == instead of ===. What's in variable 1?

I've given Variable 1 the value of 25, it's just a random value that I'm using to see if I can get it working.

Also == and === have the same effect in this case. I can deal damage but not receive any.

Last edited:

#### ATT_Turan

##### Forewarner of the Black Wind
Also == and === have the same effect in this case.
With RPG Maker they always will. Unless you manually set a variable to something weird, they will always be numbers and not need to be a strict comparison.

I can deal damage but not receive any.
Because enemies don't have an actorId() field. When an enemy uses the skill, calling actorId() is undefined and zeros out the entire formula.

#### kn1000a

##### Golden Vampire
How much of these can be applied on VXA? I know MV uses javascript but idk how much I can reference, I could not find a comprehensive "Damage Formula 101" for VXA (Forma wrote one but it was not as in depth with each functionality)

Are these functions here like currentExp() the same in VXA? Would've be so nice if VXA let me uses as much as what is documented here.

#### ATT_Turan

##### Forewarner of the Black Wind
Are these functions here like currentExp() the same in VXA? Would've be so nice if VXA let me uses as much as what is documented here.
No, VX uses Ruby for scripting while MV/Z are coded in JavaScript - two completely different languages.

You can look up the VXAce script call list for functions to use in that engine.

### Latest Profile Posts

New here! Hello!
Life is strange. I am currently in a train-the-trainer course for Fraud Docs and Counterfeiting Techniques. And our assignment last night was to make several counterfeit documents using simple tools like Paint and such. And I actually learned stuff that might be helpful in trying to make/edit things for RM assets. I don't think that is what the course developer had in mind!
Onward to more RM game dev glory.... in about 14 minutes.
grief rpg maker... why oh why did I have to jump through like 30 hoops to (hopefully) have fixed the engine targeting ko'd people during multi hit/random attacks?