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
4
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.
 

Springleaf

Villager
Member
Joined
May 31, 2020
Messages
7
Reaction score
3
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.
DUUUUDE!!! you fixed it! : D
man i was going crazy with this! It happened with equip core and party system.
Mad props to you man your the best! <3<3<3<3
I placed you on the credits of my game. your my hero xD
 
Last edited:

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

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,070
Members
137,577
Latest member
SadaSoda
Top