Applying DOT as a result of an attack

Hello everyone, I just got into RPG Maker MV and was trying to design skills for my enemies. I want my enemy to have a skill named: ''Fists of Fire.'' It is going to be a self-buff that increases his attack and applies a fire DOT debuff whenever he attacks while having the buff. So I managed to increase my enemies attack when he uses it, however, I don't know how I'm going to get it to apply a debuff to my heroes when the enemy attacks. I want them to receive ticking DOT damage at the end of each number of specified turns. Help, advice or tricks will be much appreciated.

Thank you in advance.
Hmm, this is my idea:
1. Make the buff into a state instead. You could set the "Attack" parameter into 150% (or how much you need to buff the enemy) and "HP regeneration" ex-parameter into minus value (however, this will cause the damage tick to happen every turn).

2. If you want it to be on every specific turn, we'll try using battle event for the tick instead. Set an event that runs every turn (try "turn 1+1*X"). Put a conditional branch with "Enemy" and "State" option (so the event would trigger only if the enemy is using Fist of Fury).

3. Use a variable that continue to increase every turn. Let's say we want the Fist of Fury to cause damage every 3 turn. Every time the conditional branch trigger, increase the variable by 1. Set another conditional branch that when the variable reaches 3, it called for damage.

4. How could we call for damage?
a. You could try using another event command "Change Enemy HP", and set it to decrease by specific amount. Unfortunately, when I tried it, the change doesn't appear on screen.
b. Perhaps we could try using "Force action" command, instead. Create a skill that targeted user and cause minus recover HP.
c. Another way is using a damage-inflicting state that persist only for a turn. Use the "Change Enemy State" command to inflict it.

5. Don't forget to set the variable back to 0 after the damage. Additionally, if the battle ends before the tick is activated, the variable might still have the new value inside. So I suggest for you to set those variable to 0 back somehow (if you're having a problem here, you could ask again).

6. Unfortunately, if there are multiple enemies capable of using Fist of Fury, that also means you're also required to make more than a single variable for each of them (8, at max, since I believe that's the max number for enemy troops).
that is done by states like the poison state.
If you don't know how to handle the database I suggest you follow the link to the starting point in my signature and work through the tutorials listed there.
that is done by states like the poison state.
If you don't know how to handle the database I suggest you follow the link to the starting point in my signature and work through the tutorials listed there.
Thanks i did it. However when i do a frost version of it my enemy just seems to ignore my ice attack and apply the fire debuff even though i conditioned it to be usable only when he has the frost buff. Was it clear enough?
Hmm, this is my idea:
1. Make the buff into a state instead. You could set the "Attack" parameter into 150% (or how much you need to buff the enemy) and "HP regeneration" ex-parameter into minus value (however, this will cause the damage tick to happen every turn).

2. If you want it to be on every specific turn, we'll try using battle event for the tick instead. Set an event that runs every turn (try "turn 1+1*X"). Put a conditional branch with "Enemy" and "State" option (so the event would trigger only if the enemy is using Fist of Fury).

3. Use a variable that continue to increase every turn. Let's say we want the Fist of Fury to cause damage every 3 turn. Every time the conditional branch trigger, increase the variable by 1. Set another conditional branch that when the variable reaches 3, it called for damage.

4. How could we call for damage?
a. You could try using another event command "Change Enemy HP", and set it to decrease by specific amount. Unfortunately, when I tried it, the change doesn't appear on screen.
b. Perhaps we could try using "Force action" command, instead. Create a skill that targeted user and cause minus recover HP.
c. Another way is using a damage-inflicting state that persist only for a turn. Use the "Change Enemy State" command to inflict it.

5. Don't forget to set the variable back to 0 after the damage. Additionally, if the battle ends before the tick is activated, the variable might still have the new value inside. So I suggest for you to set those variable to 0 back somehow (if you're having a problem here, you could ask again).

6. Unfortunately, if there are multiple enemies capable of using Fist of Fury, that also means you're also required to make more than a single variable for each of them (8, at max, since I believe that's the max number for enemy troops).
Wow thanks a lot. I will try to apply these. I didnt understand some of them because i havent looked into them yet but thanks.
If you'd like, you can also use this plugin:

Code:
/*:
* @plugindesc Allows the user to add notetags to skills to indicate that, if the user has one state, the skill
* should apply another state to the target.
* @author Zevia
*
* @help In a skill, write the notetag: "<debuffer: x, y, z...>", where
* x, y, z, and any other variables are state IDs. The first number is the state
* the user needs in order to apply all the subsequent states to the target.

* For example, in a default project, <debuffer: 3, 4> in a skill's notetag would
* mean, "If the user has state ID 3 (Immortal), then the target receives state ID
* 4 (Poisoned)." <debuffer: 3, 4, 6, 8> would say, "If the user has state ID 3
* (Immortal), then the target receives state IDs 4 (Poisoned), 6 (Silence), and
* 8 (Confusion)".
*/

(function(module) {
    'use strict';

    module.Zevia = module.Zevia || {};
    var DebufferState = module.Zevia.DebufferState = {};

    DebufferState.evalDamageFormula = Game_Action.prototype.evalDamageFormula;
    Game_Action.prototype.evalDamageFormula = function(target) {
        var value = DebufferState.evalDamageFormula.call(this, target);
        var debuffer = this.item().meta.debuffer;
        if (!debuffer) { return value; }

        var stateIds = debuffer.match(/\d+/g);
        if (stateIds.length < 2) { return value; }

        var buffId = parseInt(stateIds[0]);
        if (isNaN(buffId)) { return value; }

        if (this.subject().isStateAffected(buffId)) {
            for (var i = 1; i < stateIds.length; i++) {
                var stateId = parseInt(stateIds[i]);
                if (isNaN(stateId)) { return value; }

                target.addState(stateId);
            }
        }

        return value;
    };
})(window);

In the notetags of a skill, put
Code:
<debuffer: x, y, z...>
where x, y, z, etc. are state IDs. The first number is the state the user needs in order to apply all the other states to the target. For example, in a default project, if the Attack skill has the notetag
Code:
<debuffer: 3, 4>
then if the user has State 3 (Immortal) and uses the Attack skill, the target will be afflicted with State 4 (Poisoned).

You can apply multiple states by just adding more numbers:
Code:
<debuffer: 3, 4, 6, 8>
would mean, "If the user has State 3 (Immortal), then the target receives States 4 (Poisoned), 6 (Silence), and 8 (Confusion)".

If you misspell "debuffer" or include less than 2 numbers, then nothing should happen and the damage formula will be evaluated as normal.

Any action that does not call Game_Action.prototype.evalDamageFormula (for example, when an attack misses) will not call this extra logic. So if an attack misses, the state will not apply.

Here's some screenshots of an example:

Spoiler: Example Debuffer State With "Poison Fists"
State 11, Poison Fists:
pY44fEP.png


Poison Fists skill that applies a buff:
joYBkjd.png


Attack skill with the debuffer notetag:
3UOJDA6.png


Using the Attack skill without the Poison Fists buff:
GdIKBzO.png


Buffing with Poison Fists:
vht6EFl.png


Attacking with the Poison Fists buff:
maDQppV.png
If you'd like, you can also use this plugin:

Code:
/*:
* @plugindesc Allows the user to add notetags to skills to indicate that, if the user has one state, the skill
* should apply another state to the target.
* @author Zevia
*
* @help Allows for setting up skills to apply states to the target if the user has a
* particular state. In a skill, write the notetag: "<debuffer: x, y, z...>", where x, y, z,
* and any other variables are state IDs. The first number is the state the user needs in
* order to apply all the subsequent states to the target.
* For example, in a default project, <debuffer: 3, 4> in a skill's notetag would mean, "If
* the user has state ID 3 (Immortal), then the target receives state ID 4 (Poisoned)."
* <debuffer: 3, 4, 6, 8> would say, "If the user has state ID 3 (Immortal), then the target
* receives state IDs 4 (Poisoned), 6 (Silence), and 8 (Confusion)".
*/

(function(module) {
    'use strict';

    module.Zevia = module.Zevia || {};
    var DebufferState = module.Zevia.DebufferState = {};

    Game_Actor.prototype.hasState = function(stateId) {
        return this._states.indexOf(parseInt(stateId)) !== -1;
    };

    DebufferState.evalDamageFormula = Game_Action.prototype.evalDamageFormula;
    Game_Action.prototype.evalDamageFormula = function(target) {
        var value = DebufferState.evalDamageFormula.call(this, target);
        var debuffer = this.item().meta.debuffer;
        if (!debuffer) { return value; }

        var stateIds = debuffer.match(/\d+/g);
        if (stateIds.length < 2) { return value; }

        if (this.subject().hasState(stateIds[0])) {
            stateIds.slice(1).forEach(function(stateId) {
                target.addState(stateId);
            });
        }

        return value;
    };
})(window);

In the notetags of a skill, put
Code:
<debuffer: x, y, z...>
where x, y, z, etc. are state IDs. The first number is the state the user needs in order to apply all the other states to the target. For example, in a default project, if the Attack skill has the notetag
Code:
<debuffer: 3, 4>
then if the user has State 3 (Immortal) and uses the Attack skill, the target will be afflicted with State 4 (Poisoned).

You can apply multiple states by just adding more numbers:
Code:
<debuffer: 3, 4, 6, 8>
would mean, "If the user has State 3 (Immortal), then the target receives States 4 (Poisoned), 6 (Silence), and 8 (Confusion)".

If you misspell "debuffer" or include less than 2 numbers, then nothing should happen and the damage formula will be evaluated as normal.

Any action that does not call Game_Action.prototype.evalDamageFormula (for example, when an attack misses) will not call this extra logic. So if an attack misses, the state will not apply.

Here's some screenshots of an example:

Spoiler: Example Debuffer State With "Poison Fists"
State 11, Poison Fists:
pY44fEP.png


Poison Fists skill that applies a buff:
joYBkjd.png


Attack skill with the debuffer notetag:
3UOJDA6.png


Using the Attack skill without the Poison Fists buff:
GdIKBzO.png


Buffing with Poison Fists:
vht6EFl.png


Attacking with the Poison Fists buff:
maDQppV.png
Its gonna take a me lot of time to even comprehend what you just said
Its gonna take a me lot of time to even comprehend what you just said

Here's a video from Yanfly about how to install plugins:

To get the plugin file to put in your project's js/plugins folder, you can create a new text file, paste my code in, then save it as whatever you want to name it and add ".js" at the end. Alternatively, I've uploaded the file to this post and you can download it and just move it in.

After you've installed the plugin, following the instructions from that video, you should be able to add what are known as "notetags" to the "notes" box in the bottom right of any skill in your database editor. You can see it from my third screenshot.

For this particular plugin, the notetags are explained in the help section of the plugin, as well as in my previous post. In this case, I would put into any damaging skill your enemy has:

<debuffer: x, y>

Where x is the state ID of your Fire Fists buff state and y is the state ID of your DoT state.

If the plugin causes issues and you want to just turn it off, you can go into the plugins section of your editor, double click it, and change the dropdown option from ON to OFF - or just delete it if you'd rather not go down this route.

EDIT: Updated the plugin to have better guard clauses and to make use of isStateAffected instead of a custom hasState function.
Here's a video from Yanfly about how to install plugins:

To get the plugin file to put in your project's js/plugins folder, you can create a new text file, paste my code in, then save it as whatever you want to name it and add ".js" at the end. Alternatively, I've uploaded the file to this post and you can download it and just move it in.

After you've installed the plugin, following the instructions from that video, you should be able to add what are known as "notetags" to the "notes" box in the bottom right of any skill in your database editor. You can see it from my third screenshot.

For this particular plugin, the notetags are explained in the help section of the plugin, as well as in my previous post. In this case, I would put into any damaging skill your enemy has:

<debuffer: x, y>

Where x is the state ID of your Fire Fists buff state and y is the state ID of your DoT state.

If the plugin causes issues and you want to just turn it off, you can go into the plugins section of your editor, double click it, and change the dropdown option from ON to OFF - or just delete it if you'd rather not go down this route.

Thanks a lot im sure this is going to be very helpful. Im liking this community a lot.

Original thread: https://forums.rpgmakerweb.com/threads/applying-dot-as-a-result-of-an-attack.104132/