MV Yanfly's TurnOrderDisplay plugin has random bugs

Hi,

My game is close to a Steam release (yay) and there's still THIS one bug I haven't managed to trace and fix for years, and it's related to Yanfly's Turn Order Display plugin.

What makes the bug difficult to trace is the randomness of its occurence.

One occurence where it always happen is in a scripted combat where another battler joins in. Maybe that helps.

But in any other case, what you see in the video can happen at random times, and I can't find a common factor to them. Any clues ?



Note : I need this plugin. I can't remove it unless there's an alternative to it
new actor joining later isn't initialized and can be fixed in 2 ways I think.

use a $gameParty.refreshMotion() (if it was correct) or something re-initialize
the party if any actor/battle members join.

I need to look into the code as I modified it to get any state color (for vertical and horizontal).
but not with that fix, as not many use it that way or not seen before.

as next round for actor it should be added by than.
in a scripted combat where another battler joins in
how did that actor join?
If you have a lot of yanfly plugins you can't simply add an actor, but need a yanfly-compatible summoning plugin.

otherwise the new actor/battler will miss the data added and required by yanfly's other plugins during battle, as usually that data is only set at the beginning of the battle for the then-existing battlers.

EDIT: ninja'd
That's actually a good start !


It could solve the case when an actors joins in via "Add Actor" event command.

But another case where the turn order plugin is displaying wrong is during surprise/preemptive battles. I get that one side can't act during the first turn so they're not added to the turn order track yet, but sometimes one of the "surprised" battler manages to slip in, even if they can't act

Example below :

1728426034412.png
Up

The script i must run when an actor joins the battle is SceneManager._scene.createTurnOrderDisplay()

I have to recreate the whole turn order window in order to make it show properly. This could also solve these other random bugs, but the new issue now is that it creates a new turn order window over the previous one. I don't mine redrawing the window each turn but how can i properly remove the previous turn order window during the refresh ?
The script i must run when an actor joins the battle is SceneManager._scene.createTurnOrderDisplay()
That's not correct. All you need to do is add the actor to the list - the exact syntax for that depends on where you're adding the actor and what your reference to them is.

I'll assume you at least have the actor's ID, and we'll say that's ID 42. You would do
Code:
SceneManager._scene._turnOrderDisplay.push(new Window_TurnOrderIcon($gameParty, $gameActors.actor(42).index()));

You may also need to refresh the window to get the new icon to show up immediately,
Code:
SceneManager._scene.updateTurnOrderDisplayX();
Yes, I thought about that, but this only solves that one case when I force an actor to join the battle, but to solve every other stuff happening that breaks the turn order window isn't it easier to just redraw it during the makeActionOrder() function ?

I'm asking because that's what I'm trying and it seems to work
I'm confused by what you're talking about.

I was responding to your post where you were talking about recreating another window with createTurnOrderDisplay(). Now you're referencing makeActionOrder() (and it's orders, plural).

Those are two different functions that do two different things.
Sorry, I'll try to be more precise :

I have issues with the Turn Order Display Plugin when sometimes all the battlers are not properly displayed on the turn order track (like one battler is missing, or is showing when it's not supposed to be)


I can replicate some of those issues (for example by making an actor join mid-battle, or triggering a surprise/pre-emptive battle), but some others happen purely randomly.

Pushing the missing battler(s) into _turnOrderDisplay can solve the problem in scripted situations, but for random ones, I can't tell which one I'm supposed to push. That's when I thought about redrawing the window.

I've looked into the plugin and saw that the makeActionOrders function is called whenever an input potentially changes the turn order. So I thought I'd add the window redraw here
Pushing the missing battler(s) into _turnOrderDisplay can solve the problem in scripted situations, but for random ones, I can't tell which one I'm supposed to push. That's when I thought about redrawing the window.
You would only need to push a battler into the turnOrderDisplay if they've been added. If you're seeing a turn order display at all, that means createTurnOrderDisplay() has been executed - that adds every actor and enemy present to the list. There's nothing else to push.

There is zero purpose in even considering doing that again unless the battlers present have physically changed (and even then, as I posted above, there's no reason to recreate the entire list, you just push the new battlers into it).

For your other situations where you're seeing bugs, you could start troubleshooting by logging which icons are being shown or hidden when the list refreshes - maybe find a logical error in the preemptive and surprise attacks that's showing the incorrect things.

Constantly erasing and redrawing the window is the least efficient option (and seems the least likely to actually fix whatever the problem is, because it's not in there). But you do what you feel works for your project.

Original thread: https://forums.rpgmakerweb.com/threads/yanflys-turnorderdisplay-plugin-has-random-bugs.172466/