MV State auto-removal message not appearing in Battle Log

I don't really know what specific information to give because I've been trying to solve this all day and I'm confused about the cause of it. Adding new/updating persisting state messages shows just fine, but any that are removed due to turn decay will not have the message added to the battle log, whether it be end of turn or end of action. The icon is removed from the battler indicating the state itself does get removed properly, but no message displays.

If the state is removed manually (such as via skill effect), this forces the state removal message to show, and additionally causes other effects (ie, announcing that another state was added as a result of the removal, via Yanfly Buffs&States) to display on the same line as the removal message, even though those effects did not occur when auto-removal blocked the catalyzing message.

Logging to the console I can see that manually removing the state pushes it into the removedStateObjects array, whereas removal by turn decay does not. Testing in a blank project confirms that the removal message is supposed to display at the end of the action/turn regardless of whether the state was manually or automatically removed.

If anyone has any ideas on what to try, I'm really at my wit's end here. There are just so many functions that go into executing this, it feels impossible to track down the one stopping the message from displaying. Turning plugins off has not helped since a lot of them rely on other necessary parent/core plugins, so I cannot test the battle scene with those turned off...
I don't think there's anything we can do to help you without seeing your full plugin list. Please post screenshots of your plugin manager.
1767134972848.png
1767135013187.png
1767135024583.png
1767135034446.png
1767135043238.png
1767135060625.png
1767135070646.png



Sorry for the delay, here they all are.

Alright, the spoiler tags are not working at all... sorry.
It is the Yep-BattleEngine core. You can edit the parameters in it to get the battle log .
That only has a show/hide option for the state text as a whole, not individual add/persist/remove options. Plus, Yanfly's Battle Engine core was one that I turned off to test and it still didn't show the text, and weirdly, it didn't even remove the state at the end of the turn either.

Of the Yanfly plugins, I've tried turning off Buffs&States, Battle Engine Core, Target/Selection, the Gab extension that covers states, and Action Sequence (which I'm not even using anymore) but among those are also the only ones that make any mention of the removeState-related functions, which is why I have no idea where to look next. I don't even know how long this has been happening because I don't recall whether I've tested state removal messages in the 2 years I've been working on this project.
If you want to remove a state at the end of a turn,then that one depends on you. Did you make sure you set the turn for the state to be removed when you were making the state.
I guess you could try and check in the console what your isStateExpired and removeStatesAuto etc methods are doing.
But if you found out that it's not going into the removedStates array can you try to manually push them there? Don't know about the timings though.
Also what you could try is to use Yanfly states notetags to display a battlelog message (unless that messes your flow):
<Custom Leave Effect>
const text = state.name + " was removed from" + target.name();
BattleManager._logWindow.push("addText", text)
BattleManager._logWindow.push("wait")
BattleManager._logWindow.push("clear")
</Custom Leave Effect>
Of course that might not appear neatly with other effects. But yeah, maybe someone else figures it out for you.
If you want to remove a state at the end of a turn,then that one depends on you. Did you make sure you set the turn for the state to be removed when you were making the state.
Yes, and I've tested with both turn end and action end, and it doesn't seem to matter how many turns the state lasts for either. I think the issue is specifically that auto-removal doesn't prompt the displayRemoved/ChangedStates function to occur, because as I mentioned in my OP, even state added messages that would normally show up do not show at all if the state was added via the removal of a different state. It's like the end of the turn/action is being finalized by a plugin before the core plugin display can execute, judging by the order of things I logged in the console.

Also what you could try is to use Yanfly states notetags to display a battlelog message (unless that messes your flow):
I originally mentioned that I did this in my OP, but took it out before posting due to clutter. You're exactly right, the reason I didn't want to do that was because it messes with the flow of other state messages, causing them to appear/be cleared in a visually disruptive way. It's actually how I first discovered the problem with the auto-removal message when the two methods clashed during a battle test. There are some states where it's necessary to put manual removal messages so I can include variables and conditions, but I'd like to avoid having to do that for every state if possible.

Edit: also, in case this helps anyone, for instances where I anticipate a state being removed from multiple actors at the same time, I've found using the actual sequence of native removal steps works better:
JavaScript:
<Custom Remove Effect>
var text = "Your text here."
SceneManager._scene._logWindow.popBaseLine();
SceneManager._scene._logWindow.pushBaseLine();
SceneManager._scene._logWindow.addText(text);
SceneManager._scene._logWindow.waitForEffect();
</Custom Remove Effect>
This way, all the state messages appear on one line of text that clears and adds the next battler's removal text on that same line. With addText or _lines.push/refresh, it adds them each to their own line, which can clog up the battle log if there are a lot of individual messages.
Ok cool. Did you check if you can scan with notetags or with your own methods added that if the states have expired (compare the battlers' states at two different times and filter depending on if it's turn end or action end) and then push to that actionresult removedstates or whatever it was. Or if the timing doesn't align, just predict it depending on if the states only have 1 turn duration left.
I actually think I just found the cause. It turns out several lines in the rpg_manager file were commented out... but not in the format I personally use to modify things. I always leave a specific tag ("//myedit", followed by a brief explanation of why I made the edit) so I can find my own modifications, but these were commented out with a double space between the "//" and the code, which has always been visually unappealing to me but I leave it alone when I encounter it so I can tell which edits were not made by me.

The only possible explanation I can offer for this is that I must've been following a guide at some point when I first started that advised replacing those functions with a copypaste version that contained the commented-out lines, because it wasn't until a bit later in development that I started adding the username of the person I took any editing advice from (and sometimes even a link to the post) next to the changes I made using their modifications so that I could find the source later, in case something went wrong... exactly because situations like this kept happening

But that aside, I really have absolutely no idea why this particular change would've been made at all. I can't think of a single thing I would've been trying to achieve with such an unnecessary modification when simply leaving the removal message field blank required no editing at all.

Sorry for wasting everyone's time. I appreciate the help, if only there were a forum dedicated to solving mysteries of stuff we did when we were beginners, lol
I always leave a specific tag ("//myedit", followed by a brief explanation of why I made the edit) so I can find my own modifications, but these were commented out with a double space between the "//" and the code, which has always been visually unappealing to me but I leave it alone when I encounter it so I can tell which edits were not made by me.
my recommendation is to not touch those files at all. if you need to change something, copy the function, put it into a new js file, and make the change a plugin. that way you dont have to "find" your changes, theyre all in one place, and you can easily disable or tweak your new code from one file.

even if youre...
replacing those functions with a copypaste version
you get the same results pasting the altered function into a plugin and loading that plugin as the first in the plugin list

But that aside, I really have absolutely no idea why this particular change would've been made at all.
also worth mentioning, i think theres places core scripts that has actual commented code in it? I know theres a bunch of Game_Action functions that have commented "target" parameters, but i haven't actively looked for similar comments
I know it's considered bad practice, but it's much easier for me to keep track of things when it's all right in front of me rather than having to switch between multiple tabs, which I already struggle with when juggling plugins. I don't expect this to justify it to anyone, but I do keep backups of the original files in a separate location, and can just switch those back in at any time. I will move the changes to separate js files for launch, but for now, I'd be a lot worse off organization-wise if I separated it during production.

also worth mentioning, i think theres places core scripts that has actual commented code in it? I know theres a bunch of Game_Action functions that have commented "target" parameters, but i haven't actively looked for similar comments
They aren't commented out in the original plugin copy, just the one I've been editing. But yes I know what you mean, I've come across commented out stuff in untouched scripts before.

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/state-auto-removal-message-not-appearing-in-battle-log.181687/