YEP Row Formation + CTB Compatibility Fix

jerseyware

Narrative over all.
Member
Joined
Oct 16, 2013
Messages
23
Reaction score
25
First Language
English
Primarily Uses
RMMV
Hello all,

In testing using yanfly's wonderful Row Formation alongside the Charge Turn Battle system, I came across an issue.

When the Row menu is invoked during combat and then closed, the CTB turn-order gauge is not called again. I've found the lines in code where the Row script calls the Battle Engine Core and this appears to redraw the screen without the gauge.

This is tested and verified in a stand-alone demo which contains only YEP's Core, Battle Engine Core, CTB, and Row Formation. These scripts can be found at the following links:

YEP Core Engine - http://yanfly.moe/2015/10/09/yep-1-core-engine/
YEP Battle Engine Core - http://yanfly.moe/2015/10/10/yep-3-battle-engine-core/
YEP Battle System Charge Turn Battle - http://yanfly.moe/2015/12/05/yep-38-battle-system-charge-turn-battle/
YEP Row Formation - http://yanfly.moe/2016/01/02/yep-54-row-formation/

Changing the load order of these scripts has no effect on this issue. I believe this can fixed by importing sections of the CTB code to the Row Formation script in a similar fashion to the imports of the Battle Engine Core, but I do not know which parts to import. I'm hoping someone more knowledgable than I can point me in the right direction.

Here is my test project reproducing the error: https://www.mediafire.com/file/caznyrd8w77ckv7/CTB_FR_Demo.zip

Steps to reproduce:
1) Start game and walk into the enemy. Note the CTB Turn Order Gauge showing party members with Blue and enemies with Red.
2) Press "Esc" to back into the Party menu, choose "Row," then exit the Row Formation menu with "Esc" or "X."
3) Note the CTB Turn Order Gauge is now gone.

At line 2457 in YEP_RowFormation.js, there is a section of code that accounts for Battle Engine Core. I think there needs to be an accounting for CTB as well, as CTB has lines of code to create the Turn Order gauge. Line 2242 of YEP_X_BattleSysCTB.js looks like the start of the Turn Order gauge code. I don't know what to import, or how.

Thanks for reading!
 

jerseyware

Narrative over all.
Member
Joined
Oct 16, 2013
Messages
23
Reaction score
25
First Language
English
Primarily Uses
RMMV
Is there a tutorial anywhere that discusses importing portions of the primary scripts so I can learn how to resolve this myself? I don't yet have the required posts to offer a bounty for this issue.
 

GloClo

Warper
Member
Joined
Jun 28, 2018
Messages
4
Reaction score
2
First Language
English
Primarily Uses
RMMV
Hey @jerseyware, seeing how old this is, maybe you've solved it by now, but I happened to have the same issue. Figured it out and learned a lot about scenes in the process. Hopefully this helps somebody.

You can insert the below snippet into Yanfly's CTB plugin. You'll probably want to put it into the Scene_Battle section.

The comment explains the issue in detail.

Code:
/* GloClo Edit:
    Resets the _addedCTBIcon flag so that turn order can
    be redrawn properly. When we go from Scene_Battle to another
    Scene in the middle of battle, the turn order icons are cleared to
    properly show the new scene.
    
    However, the _addedCTBIcon remains set as true on the Sprite_Battler
    objects, so the CTB plugin does not redraw because it thinks the icons
    have already been added.
    
    This will ensure that whenever we are recreating display objects
    in a Scene_Battle object, the _addedCTBIcon flag is reset to false
    so that it will know to re-add the icons.
  */
Yanfly.CTB.Scene_Battle_createDisplayObjects =
    Scene_Battle.prototype.createDisplayObjects;
Scene_Battle.prototype.createDisplayObjects = function() {
    Yanfly.CTB.Scene_Battle_createDisplayObjects.call(this); 

    if (BattleManager.isCTB()) {
      var registeredSprites = BattleManager._registeredSprites;
      for (var property in registeredSprites) {
        registeredSprites[property]._addedCTBIcon = false;   
      };
    }
};
Based on my limited understanding, I think this would have been a problem for any scene change during battle, ie: @Yanfly's Change Battle Equip. There may be a better solution, but far as I can tell, this code is only called once every time you initiate or return to the battle scene. So if nothing else, it has a minimal performance impact.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Saying overused tropes are bad is like saying I - IV - V - I chord progression is bad.
I swear, the last 3 weeks I haven't felt like helping people at all. No idea why, even if I know the exact solution they need. Might need to harness my inner @Shaz or something. :LZSexcite: :thumbsup-right:
Look, I get that it's illegal, but...
It just happen we got P7 as booth number, so i draw Girls Frontline's P7 in this
Stream will be live shortly! Going to start with some Minecraft spriting, and might switch mid-stream. Depends~ Feel free to drop by!

Forum statistics

Threads
93,474
Messages
912,776
Members
123,010
Latest member
amipepper
Top