MV [SOLVED] YEP's STB plugin issue with interactions between States & Reserve Actors

This is a followup post to my previous post(s) but I believe I have figured out the real problem, this is a different issue so I didnt think I should reopen the old thread since this is different and more of a bug with a different plugin.

Basically I have a Skill that applies a State to ALL Actors but for some reason when done by the FINAL Actor to have their Action Turn in a STB, the State is applied to the Active Actors but Reserve Actors dont have it applied and will even have other States REMOVED alongside them not getting the Skill's State applied. I figured this is an issue with specifically YEP's STB due to the way the game now handles Action Turns and NOT the States themselves being applied as this all works fine when using other Actors besides the Final Actor.

Anyone know if there is a way to fix this for YEP's STB or is this just something I'll have to deal with?
Also sorry for my other thread, I was pretty confused and didnt know what or why this was happening but I think this is the true issue like I said previously
the State is applied to the Active Actors but Reserve Actors dont have it applied and will even have other States REMOVED alongside them not getting the Skill's State applied. I figured this is an issue with specifically YEP's STB due to the way the game now handles Action Turns and NOT the States themselves being applied as this all works fine when using other Actors besides the Final Actor.
one thing about the snippet i gave the other day is that i didnt factor in states not being turn removal. so your tagged action removal states and non removal states would be subject to ticking down at the end of the turn with it. I dont think they should have been removed except action ones after the following action once they switch in, but i havent looked.

Try this adjustment first and see if that has to do with it
Spoiler
Code:
(() => {
    var _endTurn = BattleManager.endTurn
    BattleManager.endTurn = function() {
        _endTurn.call(this);
        $gameParty.allMembers().forEach(m => {
            if (!$gameParty.battleMembers().contains(m)){
                m._states.forEach(s => {
                    if ($dataStates[s].meta.BacklineUpdate && m._stateTurns[s] > 0 && dataStates[s].autoRemovalTiming === 2){
                        m._stateTurns[s]--;
                    }
                })
            }
            m.removeStatesAuto(2)
        })
    };
})();
Also, have you played around with the load order at all? like i mentioned in the previous thread, it worked differently based on its position around yanfly's battle engine for me
one thing about the snippet i gave the other day is that i didnt factor in states not being turn removal. so your tagged action removal states and non removal states would be subject to ticking down at the end of the turn with it. I dont think they should have been removed except action ones after the following action once they switch in, but i havent looked.

Try this adjustment first and see if that has to do with it
Spoiler
Code:
(() => {
    var _endTurn = BattleManager.endTurn
    BattleManager.endTurn = function() {
        _endTurn.call(this);
        $gameParty.allMembers().forEach(m => {
            if (!$gameParty.battleMembers().contains(m)){
                m._states.forEach(s => {
                    if ($dataStates[s].meta.BacklineUpdate && m._stateTurns[s] > 0 && dataStates[s].autoRemovalTiming === 2){
                        m._stateTurns[s]--;
                    }
                })
            }
            m.removeStatesAuto(2)
        })
    };
})();
Also, have you played around with the load order at all? like i mentioned in the previous thread, it worked differently based on its position around yanfly's battle engine for me
I think I may have worded my post kinda poorly as the states I was talking about ARENT action removal ones, I more so meant when an actor is able to perform an action.

Basically in this image is the turn order with actors on the left getting to their action first, but when it gets to the blue actor (which is the final actor in this scenario) for some reason when said final actor to get an action SPECIFICALLY tries to use a skill to give every actor a state, it doesnt work for the reserve actors and even removes states that were already on those reserve actors?
1751166173046.png


As for the placement, I havent actually tried moving around the placements of plugins so maybe that'd help somehow? I dont think it's the backline state update plugin messing up but maybe it'd fix it anyway? And for the code, do I just edit the code of the plugin by replacing that part of it with that new code right?
I think I may have worded my post kinda poorly as the states I was talking about ARENT action removal ones, I more so meant when an actor is able to perform an action.

Basically in this image is the turn order with actors on the left getting to their action first, but when it gets to the blue actor (which is the final actor in this scenario) for some reason when said final actor to get an action SPECIFICALLY tries to use a skill to give every actor a state, it doesnt work for the reserve actors and even removes states that were already on those reserve actors?
View attachment 343875

As for the placement, I havent actually tried moving around the placements of plugins so maybe that'd help somehow? I dont think it's the backline state update plugin messing up but maybe it'd fix it anyway? And for the code, do I just edit the code of the plugin by replacing that part of it with that new code right?
Oh my god wait, I just moved aroudn the reserve party state plugin like you said to do and now the states being applied and stuff works perfectly fine?? Im so dumb, im sorry, I THINK this should be good now tho so thank you!

I still think I wanna put in that code for action removal states tho, just to be on the safe side so I just paste that code in over the normal code?
I just paste that code in over the normal code?
yep. the actual change is in a single line, but i provided the entire thing so you could just copy-paste over what i gave before
yep. the actual change is in a single line, but i provided the entire thing so you could just copy-paste over what i gave before
Alrighty! Thank you so much again!

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/solved-yeps-stb-plugin-issue-with-interactions-between-states-reserve-actors.178591/