User Tools

Site Tools


damage_formula

Damage Formula

When you select a potion type of an item or select a skill, you can enter a damage formula.

But what if you enter something else instead of the damage formula? (For example, item payment, skill payment, gold payment)

It works!

a means attacker, b means defender. The available variables and functions in a are:

* Note that a and b are both ScriptUnit objects.

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 of a
a.y: Coordinates of a Y
a.atk: a damage of a
a.def: defense of a
a.magicAtk: a magical attack power
a.magicDef: magic defense of a
a.agi: agility of a
a.luk: the 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 x, y coordinates on map 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.

Example) Skill Formula 1  Damage = Attack of the attacker - Defense of the defender

a.atk - b.def

Example) Skill Formula 2 Damage = Random damage between 10 and 50

rand (10, 50)

Example) Item Damage Formula - When a item uses an item, if you put it in the damage formula as below, you can learn the skill when using the item.

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

Example) Skill Damage Formula - consuming 10 gold for each skill of my skill

b.UseGameMoney (10)

Example) I want to take away items and take gold too!

a.RemoveItem (1, 10) or a.UseGameMoney (10)
damage_formula.txt · Last modified: 2019/01/17 05:35 by kernys