MV Custom Enemy State Duration? [Solved]

So back in VX Ace, Yanfly had a function to Buff and States Manager that allowed enemies to have custom durations for how long/short turns are assigned to them. I used this to have, say, zombies get afflicted by the Burn status for ten turns as opposed to the regular 4.

However, in MV, it only seems to work if you're tying it to skills or items only...

The only thing I found that could even somewhat fit what I want is @A_Higher_Plane 's Change State Duration plugin, but his plugin is very buggy and has it so that if any state duration change is applied to any battler, it's a global change.

(EX. Time Stop is normally 4 turns. If one enemy has "state duration 38: +1", every enemy in the game gets +1 to their time stop counter, even if the other enemies don't have the notetag applied to them. Which is absolutely terrible.)

Am I missing something here? Is there something in the Lunatic Code for Yanfly Buff and States Core that allows me to manually set it so Enemies have individual turn durations?

(Optimally you can hand me a fresh JS plugin that does this exact thing I want, hence why it's in requests)
A way of solving this would be action sequencing. Make different states for enemy types and then in your sequence just have a conditional branch like "If target isstateaffected zombie" apply your long burn state and so on.
I don't know if this helps, but I believe all battlers in the battle scene
have a property called "_stateTurns[stateId]".

It should be possible to manually change the remaining duration of a state via script call.

e.g.
JavaScript:
$gameTroop.members()[0]._stateTurns[38] += 1

Obviously, only you know where to appropriately use this.

Of course, using Yanfly plugins, you could use their notetags to do this using a custom apply effect for the state.

For example:

JavaScript:
<Custom Apply Effect>
if (user.isEnemy()) {
   user._stateTurns[38] += 1;
};
</Custom Apply Effect>
I don't know if this helps, but I believe all battlers in the battle scene
have a property called "_stateTurns[stateId]".

It should be possible to manually change the remaining duration of a state via script call.

e.g.
JavaScript:
$gameTroop.members()[0]._stateTurns[38] += 1

Obviously, only you know where to appropriately use this.

Of course, using Yanfly plugins, you could use their notetags to do this using a custom apply effect for the state.

For example:

JavaScript:
<Custom Apply Effect>
if (user.isEnemy()) {
   user._stateTurns[38] += 1;
};
</Custom Apply Effect>

So we got something cooking with this. Attaching the custom apply effect to the Time Stop state itself makes enemies have one extra turn of time stop compared to allies.

I think to really make this what I want though, is to have it so only unique enemy IDs are affected by the increase in the duration. I don't know what the proper MV version of $data_enemies[@enemy_id] is in javascript calls, though.
@RCXGaming

For Actors use either:
battler property: _actorId
getter function: actorId()

For Enemies use either:
battler property: _enemyId
getter function: enemyId()

-> Usually I would go for the function because they were made
specifically to give you the value, but both should work just fine in this case.

So in your notetag, it could look like this:

JavaScript:
<Custom Apply Effect>
if (user.isEnemy() && user.enemyId() == 15) {
   user._stateTurns[38] += 1;
};
</Custom Apply Effect>

This would increase the duration of state 38 by 1 if the battler is an enemy with the ID 15.
@ScorchedGround You're a legend. Thanks so much for this. 😂
@RCXGaming
You're welcome 🙂

An additional note, if you ever need it and didn't know about it already;

Whenever you want to check for more than one enemy ID, you can construct the condition this way:

JavaScript:
[12,15,19].includes(user.enemyId())

This will check if the 'user' has the ID of any number inside the array. In my example this would be true
if the enemy had the ID's 12, 15 or 19.

You can put as many numbers and whatever numbers you want in there.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/custom-enemy-state-duration-solved.155501/