XP Formula Library

From HimeWorks
Revision as of 20:13, 19 February 2016 by Bluebooth (Talk | contribs)

Jump to: navigation, search

Formulas are Ruby expressions that are evaluated at run-time. You can use them in damage formulas to determine how much damage you inflict with a skill, or you can use them in script calls to perform certain functions that aren't provided through the event interface by default.

A formula may contain special formula variables that you can use to craft your formulas.

Damage Formulas

Damage formulas by default are used in Skills and Items, and are primarily used to determine how much base damage the action will inflict.

The following formula variables are available:

  • a - user of the action
  • b - target of the action
  • v - game variables (equivalent to $game_variables)

Common XP Formulas

Normal Attacks

Power = a.atk - (b.def / 2) Rate = 20 + a.str Variance = 15 Minimum power = 0


If Skill Power is positive: Power = (a.atk x skill.atkFactor / 100) - (b.def x skill.defFactor / 200) - (b.mdf x skill.mdfFactor / 200) Variance = skill.variance Minimum power = 0

If Skill's Power is negative: Power = 20 + (a.str x skill.strFactor / 100) + (a.dex x skill.dexFactor / 100) + (a.agi x skill.agiFactor / 100) + (a.int x skill.intFactor / 100) Variance = skill.variance


HP recovery amount is negative: Power = -Amount HP Recovered - (b.def x item.defFactor / 20) - (b.mdf x item.mdfFactor / 20) Variance = item.variance Minimum power = 0

HP recovery amount is positive: Power = -Amount of HP recovered Variance = item.variance Minimum power = 0

Damage = power x multiplier / 20 x elemental modifier x critical modifier x defense modifier (+- variance %)

Elemental modifier: The weakest of b's effective elements corresponding to the action's element (s). [A: 200%, B: 150%, C: 100%, D:50%, E: 0%, F: -100%] Critical modifier: Equals 2 when the damage is positive and a critical hit is made. Defense modifier: Equals 1/2 when the damage is positive and b is defending.

Hit Formula

Hit formulas by default are used in Skills, and are primarily used to determine whether an attack hits successfully or not. In XP, "to hit" is split into:

  • First Hit
  • Is Critical Hit?
  • Second Hit

Common XP Formulas

First Hit

Normal Attacks: First hit rate = a.state.hitRate Skills If Attack Power F is 1 or greater (physical attack): First hit rate = skill.hitRate x a.state.hitRate / 100 Skills If Attack Power F is 0 (non-physical attack): First hit rate = skill.hitRate Items: First hit rate = item.hitRate

If a's condition is normal, the state hit rate is 100.

Is Critical Hit?

Normal Attacks: Critical hit rate = 4 x a.dex / b.agi Skills: Critical hit rate = 0 Items: Critical hit rate = 0

Second Hit

If damage is negative, second hit rate = 100%

If damage is positive: If b's condition is normal: evasion = 8 x b.agi / a.dex + b.evade

Normal attacks: Second hit rate = 100 - evasion Skills: Second hit rate = 100 - (evasion x skill.evasionF / 100) Items: Second hit rate = 100%

Escape Formula

Determines whether an escape attempt is successful or not.

Common XP Formulas

Successful escape rate = 50 x playerParty.avgAgi / monsterTroop.avgAgi

Related Topics


  • RPGMaker XP Product Documentation (Enterbrain)