Script Making Enemies Invincible?

I've created a script for a class focused on using Psychic powers to damage enemies. One of the skills included is called "Psychic Splinter" which initially damages the enemy and places a state on them "Mind Splinter" which is as follows

Mind Splinter
- Element Rate: Psychic * 120%
Code:
<Custom Leave Effect>

target.startAnimation(102);

target.addState(161);

target.addState(16);

</Custom Leave Effect>

<Reapply Ignore Turns>

After that, it then leaves state (16) Which is a basic Daze, and state (161) which is as follows, "Mind Scorched",

Mind Scorched
- Parameter Max MP * 75%
- Element Rate * Psychic * 105%
Code:
<DoT Formula: b.mmp * 0.1 + 20 * a.level>

<DoT Element: Psychic>

The problem I'm having here is that after Mind Splinter expires and leaves Mind Scorched, the enemy in question becomes invincible for some reason. If I attack, the enemy will receive the damage popups, but no damage will actually be applied. I have no idea how I can fix this, any idea what the problem is? (I'm using a multitude of Yanfly's plugins, if not already noticeable.)

EDIT: Posted this before realizing I was posting in the wrong place >_<
I suggest posting screenshots of the skill and all three states, so we can see all the details.
EDIT: I guess the image function doesnt work, eh?
MOUSKbu

N1TrsfL

kyXykEq

CsvwT5E

uxdrz
Do you have an image for state 16 you can show?
Untitled.png
Sorry Sorry >_<
Hmm, the only obvious problem I'm seeing right now is that you're applying the Mind Splinter state twice -- once in the damage formula and once in the effects.

Here's my best guess at what's happening, but I apologize that I'm not able to give you a definitive answer:

I'd guess it has to do with your use of "a" in the Mind Scorched DoT tag. "a" refers to the state's origin. I've been trying to decipher Yanfly's code related to that, and the best I can tell, this is happening:

Mind Scorched gets applied not by an attack, but by the decay of the Mind Splinter state. Due to this, the state's origin appears to default to the battler who lost the Mind Splinter state.

If you're testing this on enemies, they don't have levels (unless you're using Yanfly's Enemy Levels), so it's probably causing an error in your DoT formula...which is having...some kind of effect. My best guess is that the enemy is actually being dealt damage, but the DoT effect, due to this error, is probably giving them some kind of health regen. The best way to test this theory would be to make a skill that's a certain hit with a damage formula of 99999, or something like that which should kill anything outright. See if you can kill the enemy with that skill once they're in the Mind Scorched state.

Or you could just take out the a.level part of the DoT formula and see if that fixes the problem.
Is the enemy immune to state 1 or have you changed state 1 at all?
Or you could just take out the a.level part of the DoT formula and see if that fixes the problem.

This fixed the problem! Thanks!

Original thread: https://forums.rpgmakerweb.com/threads/script-making-enemies-invincible.88424/