+ -

17 - Damage Calculation

From tutorials 7 and 8 (Setup an Enemy and Setup a Player), you already have a basic idea of how to create collision events and how to assign skills or weapon database damage/traits to an event. In this lesson, we’ll go a bit deeper into that.

To make an event use the damage/traits information from the Database, add this notetag inside the event:

<dmg: skill name>

Example: <dmg: Fire Ball>

This event now acts as the skill named Fire Ball in the database, using that skill's traits. Any event or player that spawns an event with this notetag will be recognized as the attacker. In other words, if the formula of the skill Fire Ball is a.atk - b.def, then a refers to the one who spawned the Fire Ball event.

Good for: Making ranged attack/skills or skills that need to have their own unique traits.

<dmg: weapon>

This event now acts as the main‑hand weapon attack of the player or party member, using the traits of the equipped weapon as well as the first Skill ID in the database to calculate the formula. By default in RPG Maker, the first Skill ID is named Attack.

You can change the skill ID the weapon use via trait Attack Skill.


Good for: Making direct weapon attack, using the weapon's traits.



<dmg: 2nd weapon> 

Similar to <dmg: weapon>, but it uses the traits from the weapon equipped in the Shield slot. This is typically used if your character is Dual Wielding.

Good for: Making direct second handed weapon attack, using the 2nd weapon traits.

<dmg: enemy name from database>
This event will use all the parameters and traits of the enemy with the same name in the database, as well as Skill ID 1 for the damage formula when applying damage, similar to <dmg: weapon>. It’s very suitable for creating a normal attack for an enemy.

Good for: Making direct enemy attack, using the enemy's traits.

Other Cases


<dmg: x> also supports other cases such as:
  • <dmg: 15> → deals 15 damage
  • <dmg: 15 - 30> → deals between 15 and 30 damage

These  cases do not use database parameters, so I don’t recommend relying on them.

How To Use

When you use plugin command Increase/Decrease Character HP and write down "damage" in parameter HP Change, it'll read the value from notetag <dmg: x>


Additional Support for Formula

In Skill database, if you want to use a variable, write v[variable id]. This feature is really great for making custom upgrading systems.





English
Japanese