MV YEP Skill Core - Conditional States

Hello, I would like to have a skill check the target battler for a state, and if true, apply another state. This is to create a cumulative state effect, where each is more powerful than the last (with a total of 10 stacks possible).

I'm using Yanfly's Skill Core to try and solve this problem, but I'm struggling to get it working correctly. The code below is essentially what I want to put into the skill note tag, but I couldn't get it working as a custom effect.

For what it's worth, I'm also using Shaz's state add/remove commands so that when a higher state is applied, a lower one is removed automatically.

Code:
if (target.isStateAffected(208)) { target.addState(209); }
else if (target.isStateAffected(209)) { target.addState(210); }
else if (target.isStateAffected(210)) { target.addState(211); }
else if (target.isStateAffected(211)) { target.addState(212); }
else if (target.isStateAffected(212)) { target.addState(213); }
else if (target.isStateAffected(213)) { target.addState(214); }
else if (target.isStateAffected(214)) { target.addState(215); }
else if (target.isStateAffected(215)) { target.addState(216); }
else if (target.isStateAffected(216)) { target.addState(217); }
What do these states do? Wouldn't turning it into a stacking state (like the Toxic Tips and Tricks entry from Yanfly) be easier? 😴 Either way, this can probably be shortened somehow? Also, which note tag are you using these with? That could have some influence on whether it works or not (example: using pre-damage on things that don't do damage)

(edit: also, I'm not sure if this is written correctly to begin with)
What do these states do? Wouldn't turning it into a stacking state (like the Toxic Tips and Tricks entry from Yanfly) be easier? 😴 Either way, this can probably be shortened somehow? Also, which note tag are you using these with? That could have some influence on whether it works or not (example: using pre-damage on things that don't do damage)

(edit: also, I'm not sure if this is written correctly to begin with)
The states increase an element rate incrementally, so it's not a DoT. Also, iirc, that stacking DoT didn't change the state, so it used the same state icon. I have a different icon set up for each level of the state I've created.

So far I've tried Post Damage and After Eval to no avail.
What is Skill Score? I know it's probably a silly typo for Skill Core, but you said it multiple times so I want to make sure you're not referencing some other plugin or Tip & Trick or, like, an old VX script.

The states increase an element rate incrementally, so it's not a DoT.
That doesn't matter, the concept of using a variable on the battler (or using state counters) is broadly applicable. It doesn't have anything specific to making a DoT.

Also, iirc, that stacking DoT didn't change the state, so it used the same state icon. I have a different icon set up for each level of the state I've created.
That part matters. So we'll stick with discrete states.

So far I've tried Post Damage and After Eval to no avail.
It would help to see the complete code, including notetag, of what you tried. Because what you have is a bit repetitive but it looks like it should work. If it does nothing, there's some kind of other error going on.

Here's how I would do this.

Code:
<After Eval>
for (var i=208; i<=216; i++)
{
    if (target.isStateAffected(i))
    {
        target.removeState(i);
        target.addState(i+1);
        break;
    }
}
if (i==217)
    target.addState(208);
</After Eval>

I know you said you have a plugin to automatically remove the existing state. If you're confident that works and it's not interfering with anything, you can delete the target.removeState() line. I just have it in there so this is a complete, standalone solution.
Your code works great. I don't know what the trouble with mine was--it was just the same code shone above within the <After Eval> tags. Nothing fancy... but the problem appears to be solved now. Thanks!
It may have been that you didn't have an else at the end to add state 208 in the first place.

Original thread: https://forums.rpgmakerweb.com/threads/yep-skill-core-conditional-states.159933/