Let's say you want to create a skill event that, upon colliding with an enemy event, deals damage based on a formula defined in the database. This skill will also consider enemy database attributes such as defense, magic defense, resistances, weaknesses, and more. Essentially, it mimics the default turn-based combat system in RPG Maker MZ.
Step 1
Set up your skill and name, then define the formula you want to use. For example, I’ve set it as:
(a.mat + 15) / 2 - b.mdf
This formula works as follows: it takes the party leader's Magic Attack value (a.mat), adds 15, and then divides the result by 2. Next, it subtracts the enemy's Magic Defense value (b.mdf) from that total. For a deeper understanding of formulas, please refer to this tutorial.
Step 2
Now, switch to the Enemies tab and create a new enemy. I’ll name it "Fire Mage" and set its Magic Defense to 3. To make things more interesting, adjust the damage calculation so that an attack with the Fire element is reduced to only 45% of its normal damage. Typically, it would deal 100% damage, but with this setup, it will only deal 45% to this enemy. I assume you can guess what the Ice element might do in contrast!Step 3
Next, in your skill event, add the notetag <dmg: skill name from database>. Then, in your enemy event, add the notetag <hp: enemy name from database>. With these steps, you’ve completed creating a skill that deals formula-based damage to an enemy. Keep in mind that you’ll need to consult another tutorial in this manual for details on collision mechanics and related topics, as this tutorial focuses solely on calculating formula damage.
Oh, and don't forget when Increase/Decrease Enemy HP, write "- damage" to HP Change so it'll use whatever you wrote to notetag <dmg: xxx> from skill event. Previously, you wrote a skill name from database so it'll find said skill from the database.