Damage Formulas

If you choose a potion type for an item or select a skill, you can enter a damage formula.

But what if you enter something else instead of a damage formula? For example, you provide an item, skill or gold? It still works!

In the following examples, a means an attacker and b means a defender.

Also, please note the following:

  • a and b are both ScriptUnit objects.

  • There is no b variable for items. You can get the level value of an item by its level.

  • For statuses, only the a and b variables exist.

  • For skills, the level is the level of the skill.

The variables and functions available in a are as follows:

Variables

a.id: a unique number id of a
a.type: type of a (0 = player, 1 = event, 2 = monster)
a.name: the name of a
a.x: Coordinate X of a
a.y: coordinate Y of a
a.atk: a damage of a
a.def: Defensive power of a
a.magicAtk: a magic attack power
a.magicDef: magic defense of a
a.agi: a agility of a
a.luk: luck of a
a.maxHP: Maximum health of a
a.maxMP: Maximum horsepower of a
a.hp: current health of a
a.mp: current horsepower of a

Functions

a.SpawnAt (x, y): Moves a to x, y coordinates.
a.SpawnAtField (mapID, x, y): Moves a to the x, y coordinates of mapID.
a.RespawnAt (x, y): Resumes a to x, y coordinates.
a.SetVar (id, value): Change the id variable of a to value.
a.GetVar (id): Get the id variable of a.
a.AddSkill (id, level): Adds an id skill level to a.
a.AddItem (id, count): Adds id count count to a.
a.AddGameMoney (amount): Add a gold to a.

b.RemoveSkill (id): Removes the id skill from b.
b.RemoveItem (id, count): consumes item count from b count count.
b.UseGameMoney (amount): consumes the gold amount from b.
b.StartGlobalEvent (id): Call public event id.
b.AddBuff (id): Give id status from b.
b.RemoveBuff (id): Removes the id state from b.

Example: Skill Formula 1 Damage = Attacker's Attack Power - Defender's Defense Force

a.atk - b.def

Example: Skill Formula 2 damage = Random damage between 10 and 50

rand(10, 50)

Example: Skill Damage Formula - Consumes 10 gold of the enemy hit by the skill

b.UseGameMoney(10)

Example: I want to take items and gold!

a.RemoveItem(1, 10) or a.UseGameMoney(10)

Example: Setting skill damage for a critical - For a critical (a.attack * 2) is applied, if not (a.attack) is applied

critical and (a.attack * 2) or (a.attack)

Example: Damage based on the level of the skill - If a’s magic damage is 10, b’s magical defense strength is 5, and the skill’s level is 10 then the damage to be inflicted will be 16.

a.magicAtk - b.magicDef + level +1

Example: Item Damage Formula - If the the item damage formula below is used, then a will learn a skill when using the item.

a.AddSkill (0,1) \ - \ - A to the 0th skill Lv. 1 is added.

Example: Inflict a State of Continuous Damage

After setting the type of HP Damage, enter 10 in the formula box to inflict damage over time with a 2 second minimum