Help with a DoT formula

So im not sure where to ask this. So im putting it out there. I need help with a DoT formula. Essentially, what i want is to have an attack that has a percentage to add a bleeding effect. But i want the bleeding to stack and do more damage over time. But i want the bleeding to last 3 turns unless you stack it again, which refreshes the turn count with an added stack. I essentially want to recreate Darius passive from League of Legends in a way.
30% of the damage dealt will be a dot multiplied by the target physical damage rate and target element 1 with a state counter stating how much damage the dot will do average


Skills:


<Before Eval>
target._dotDmg = target._dotDmg || 0;
</Before Eval>


<Pre-Damage Eval>
target._preHp = target.hp;
</Pre-Damage Eval>


States:
<Custom Apply Effect>
if (target._dotDmg > 0) {
target._dotDmg += Math.floor(((target._preHp - target.hp) / (target.pdr * target.elementRate(1))) * 0.3);
}
else {
target._dotDmg = Math.floor(((target._preHp - target.hp) / (target.pdr * target.elementRate(1))) * 0.3);
}
target.setStateCounter(X,target._dotDmg)
</Custom Apply Effect>
Ok so ive added the formula to the appropriate skill and states but it isnt doing any bleed damage. Is there something im missing? Is there a plugin i need?
oops l forgot


<Custom Regenerate Effect>


target.gainHp(-target._dotDmg )


</Custom Regenerate Effect>
Its still doing 0 damage
Should be working, if it doesn't, it's because you've done something wrong on your part.
You forgot to mention that this requires Yanfly's Plugin. 
Should be obvious. He asked for a dot formula.
You need this http://yanfly.moe/2015/12/25/yep-50-buffs-states-core/
@lolshtar no, DoT can be done completely without any plugin by using states alone, so asking for a DoT formula does not indicate the poster knows that he needs a plugin (because he doesn't need one), and even if he does know that there are other ways to do this than yanfly's plugins (my first idea would be using one of Tsukihime's plugins for follow-up states)


@kuroshinne If you use a state for the DoT effect, then applying the same state at a later time will automatically reset the turn count of the state. That is default without any plugin, and the way regular bleeding states work (bleeding would be a negative HP regeneration, same as poison for example).


The only thing that does not work by default is state stacking, and to add that there are several different options, from checking states on target and exchanging them in the damage formula (which still would not require any plugin, but some knowledge of javascript coding) to using plugins for state replacement.


Because it will be easier to solve with several different states (Bleeding I, Bleeding II, Bleeding III and so on) than to try to get states stacking.
Should be working, if it doesn't, it's because you've done something wrong on your part.

I copied and pasted. :/ kinda hard to mess that up. I noticed: 


Pre-Damage Eval>target._preHp = target.hp;</Pre-Damage


then next line has that target._preHp - target.hp could that be why its not working? Im still new to javascript so im still learning
What it does is taking your enemy hp before damage was done then it takes the enemy hp after damage was done because sometimes damage value isn't working properly.


So if it does 100 damage, 30% of that will be a dot for 30 damage per turn


When the dot expires, you can let it keep stacking or remove it completely using


<Custom Remove Effect>


target._dotDmg = 0


</Custom Remove Effect>
OK! So i got it working. Thank you for the help. Now, how do i add a maximum amount of stacks?... ex. I want there to only be a maximum of 5 stacks


something like this work?


if (target._dotDmg == 5) {


target._dotDmg = Math.floor(((target._preHp - target.hp) / (target.pdr * target.elementRate(1))) * 0.5);


}


target.setStateCounter(115,target._dotDmg)


target.clampStateCounter(115, 1, 5);
Those aren't stacks. Making stacks would completely makes this formula irrelevant.


Do you mean a maximum damage?
I was looking for something with stacks the whole time.
kuroshinne, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.



If you have something to add and your own post is the last, simply edit it.

I was looking for something with stacks the whole time.

See the last part of my post from a week ago. You cannot have stacks without a large rewrite, and I don't know of any plugin that does this - because it is easier to get the identical effect in another way.


you have to simulate stacks by using different states like I described above, that is the easiest way.
kuroshinne, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.



If you have something to add and your own post is the last, simply edit it.


See the last part of my post from a week ago. You cannot have stacks without a large rewrite, and I don't know of any plugin that does this - because it is easier to get the identical effect in another way.


you have to simulate stacks by using different states like I described above, that is the easiest way.

Huh? It is in fact very easy. But ill have to redo the entire formula.


Skills


<Before Eval>
target._dotStack = target._dotStack || 0;
</Before Eval>


Apply X State(Y%)


States:<Custom Apply Effect>


target._dotStack += 1;target.setStateCounter(X,target._dotStack)</Custom Apply Effect>


<Custom Regenerate Effect>


target.gainHp(X * target._dotStack)


<Custom Remove Effect>


target._dotStack = 0


</Custom Remove Effect>


Please don't say anything that isn't helpful. I know you're not using MV so you shouldn't say X requires a "large rewrite" when it isn't the case at all.
Huh? It is in fact very easy. But ill have to redo the entire formula.


Skills


<Before Eval>
target._dotStack = target._dotStack || 0;
</Before Eval>


Apply X State(Y%)


States:<Custom Apply Effect>


target._dotStack += 1;target.setStateCounter(X,target._dotStack)</Custom Apply Effect>


<Custom Regenerate Effect>


target.gainHp(X * target._dotStack)


<Custom Remove Effect>


target._dotStack = 0


</Custom Remove Effect>


Please don't say anything that isn't helpful. I know you're not using MV so you shouldn't say X requires a "large rewrite" when it isn't the case at all.

Hey thanks for the help.... I really appreciate it.... one question, what is X in this situation? is it stateid?
Yes, l can't know your state id

Original thread: https://forums.rpgmakerweb.com/threads/help-with-a-dot-formula.72211/