# 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

It's Sunday. Stop working and take a break. Relax a little.
Ooops ended up trying out making my own A2 tile page instead of testing doors everywhere. Went well so far I think.
I guess I'm done making a blue squirrel's life difficult for posting new threads on different forums.
That's just for today so don't get used to this, squirrel-ish friend!
Got new hard drive, now trying to install the softwares I lost to the dead drive, and more than half of them won't install because they're already installed on the dead drive, and uninstallers won't run because they can't find where their programs are installed. So I take it having a drive die on you screws you in more ways than just data loss. >:\
PC got fixed finally. Back online again. Turns out I have no business trying to self repair pcs because it was getting to like 176F / 80C. Shop installed a totally new cooling system and now it runs fine and is super quiet.