MV [Resolved]Issue Yanfly Battle Engine Core

Fix: Change 'this._cardTargetActions = null;' to 'this._cardTargetActions = [];' on line 9096 of MYTH_CGC_CoreEngine.js. It seems my lag is a result of party size so unless you have more than one character, you should be good.

Farther fix: Adding the following to your end turn action should reduce lag:
Code:
<Card Actions>
Discard Untill 0
/<Card Actions>

1779627519935.png

So I'm using this thing with MythAtelier's CCG plugins, and everything was working fine, but now if any of my actors are targeted while they have "block", then the game crashes... By trial and error I've figured out that the YBEC is the issue but I don't recall changing any of the settings and have no idea where to begin looking.
Have you tried playing around with the placement of the battle engine core and card game cores? If you have yanfly's battle engine below Myth's core, id reverse that.

If that doesnt do anything, provide a screenshot of your plugin manager so we can see your plugin load order.
Have you tried playing around with the placement of the battle engine core and card game cores? If you have yanfly's battle engine below Myth's core, id reverse that.

If that doesnt do anything, provide a screenshot of your plugin manager so we can see your plugin load order.
Oh right silly me.
1779629974647.png

As you can see; I already have them in that order.

Update: I suspected a null value was being sent to the battle log, but the crash happens weather the damage is equal too, greater than, or less than the damage blocked.
That one might need to be reported to them. You said you couldnt get to them through discord, but their email is open to reports. I wont post it here, but its available on the home page of their wiki. in my experience, they respond quickly.

I own some of the plugin set on itch.io from a bundle sale years ago, but that only includes 1.6.4. of the core plugin. As far as i can see, 1.6.5 is only available on steam, and looking at your trace, significant changes may have been made. The line for me that could even produce that error is 5476

looking into the 1.6.4 version, they have an explicit compatibility adjustment written in for yanfly's battle core that could lead to the property being checked being null later, so its likely that similar still exists in the current version that could be the root of the problem when combined with block, but thats the most i can say without actually knowing whats in the current versions of the plugins.
That one might need to be reported to them. You said you couldnt get to them through discord, but their email is open to reports. I wont post it here, but its available on the home page of their wiki. in my experience, they respond quickly.

I own some of the plugin set on itch.io from a bundle sale years ago, but that only includes 1.6.4. of the core plugin. As far as i can see, 1.6.5 is only available on steam, and looking at your trace, significant changes may have been made. The line for me that could even produce that error is 5476

looking into the 1.6.4 version, they have an explicit compatibility adjustment written in for yanfly's battle core that could lead to the property being checked being null later, so its likely that similar still exists in the current version that could be the root of the problem when combined with block, but thats the most i can say without actually knowing whats in the current versions of the plugins.
The really odd part is that it was working before is all...

Update: Just tried running a battle with block generate off and YBEC on, which caused a game crash at the end of the player turn if any block cards where used so:

YBEC - On
BG - On
Game crashes if any actor with block is attacked. Damage over, under or equal to block makes not difference.

YBEC - Off
BG - On
Game runs as expected but YBEC is used to keep party on the left side (Ascetic, could be sacrificed.) and actors can no longer be targeted by clicking them. (Functional, game is borderline unplayable without this.)

YBEC - On
BG - Off
Game crashes if any block generation is attempted once all party members have ended their turn... This is likely meaningless but was tested anyway.
1)
Most likely this has nothing to do with your problem, but your order for the yanfly plugins is wrong.
They should be placed in the order given on yanfly's main list on his website, top to bottom.
you can add other plugins between them where needed for compatibility, but their internal order should be like the list. And if I remember correctly that means that the last two (menu manager and message extension) are in the wrong position.

2)
for your on/off tests, did you always start a new playtest or did you continue savefiles?
always start new playtests after changing the plugin configurations like that.

loading an incompatible savefile has a high chance of NULL errors...
1)
Most likely this has nothing to do with your problem, but your order for the yanfly plugins is wrong.
They should be placed in the order given on yanfly's main list on his website, top to bottom.
you can add other plugins between them where needed for compatibility, but their internal order should be like the list. And if I remember correctly that means that the last two (menu manager and message extension) are in the wrong position.

2)
for your on/off tests, did you always start a new playtest or did you continue savefiles?
always start new playtests after changing the plugin configurations like that.

loading an incompatible savefile has a high chance of NULL errors...
1) Updated and didn't fix.

2) Yes, always tried in new play test not an old save.

Update: Tried clean instance of YBEC and got the same crash but actor placement was correct, will look for alternatives to selecting targets just in case.

Update: I seem to have traced the issue to two blocks of code in YBEC and MCGC:

YBEC:
Code:
Yanfly.BEC.Window_BattleLog_displayActionResults =
    Window_BattleLog.prototype.displayActionResults;
Window_BattleLog.prototype.displayActionResults = function(subject, target) {
    if (Yanfly.Param.BECOptSpeed) {
      if (target.result().used) {
          this.displayCritical(target);
          this.displayDamage(target);
          this.displayAffectedStatus(target);
          this.displayFailure(target);
      }
    } else {
      Yanfly.BEC.Window_BattleLog_displayActionResults.call(this, subject,
          target);
    }
    if (target.isDead()) target.performCollapse();
};

MCGC:
Code:
//============================================================================
// Window_BattleLog
//============================================================================
// #region Window_BattleLog
Window_BattleLog.prototype.displayFailure = function (target)
{
    if (target.result().isHit() && !target.result().success && BattleManager._cardActions.length == 0 && BattleManager._cardTargetActions.length == 0)
    {
        this.push('addText', TextManager.actionFailure.format(target.name()));
    }
};
It seems these are redundant or something, notably with the "this.displayFailure(target);" portion.

Commenting this out prevents the game from crashing but cause it to lag for a very long time after each turn and fail to remove the block, same result no matter which I comment... I know just enough about scripting to see which block to comment out if I want to see what happens without that one bit.
Commenting this out prevents the game from crashing but cause it to lag for a very long time after each turn and fail to remove the block, same result no matter which I comment... I know just enough about scripting to see which block to comment out if I want to see what happens without that one bit.
As i mentioned, thats where the error happens but its not the cause of it.
they have an explicit compatibility adjustment written in for yanfly's battle core that could lead to the property being checked being null later, so its likely that similar still exists in the current version that could be the root of the problem
Commenting out the error line can suppress the crash, but it doesn't fix the issue beneath it. you get the crash because BattleManager._cardTargetActions is null by the time you get to displayFailure() and its expected to be an array.

if its the same in both plugin versions, then the only place that could happen (in CGC core alone mind you), is inside BattleManager.createCardActionsActions which is only used when yanfly's battle core specifically is installed. The dev put that interaction there for a reason initially, but maybe hasnt tested it in a while and future changes now makes it an issue. you can try to comment out the point in there that sets the mentioned property's value to null or try setting it to an empty array instead of null, but im not going to pretend to know why they made it do what it does in the first place

also

@Jinx Adnix, please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.

@Jinx Adnix have you tried contacting the devs through email as @Robro33 suggested? Probably quicker than running around like decapitated poultry.
That one might need to be reported to them. You said you couldnt get to them through discord, but their email is open to reports. I wont post it here, but its available on the home page of their wiki. in my experience, they respond quickly.
As i mentioned, thats where the error happens but its not the cause of it.

Commenting out the error line can suppress the crash, but it doesn't fix the issue beneath it. you get the crash because BattleManager._cardTargetActions is null by the time you get to displayFailure() and its expected to be an array.

if its the same in both plugin versions, then the only place that could happen (in CGC core alone mind you), is inside BattleManager.createCardActionsActions which is only used when yanfly's battle core specifically is installed. The dev put that interaction there for a reason initially, but maybe hasnt tested it in a while and future changes now makes it an issue. you can try to comment out the point in there that sets the mentioned property's value to null or try setting it to an empty array instead of null, but im not going to pretend to know why they made it do what it does in the first place

also Double-post notice: @Jinx Adnix
Ah, that's what was was going on... Ya, setting the cards to card action fixed it so I have that for now, and I know what to report. Sorry about the posting thing too.

@Jinx Adnix have you tried contacting the devs through email as @Robro33 suggested? Probably quicker than running around like decapitated poultry.
Not yet, was poking at things in moments between while helping with things in real life. I'll contact them in the morning as I am very tired now.
1) Updated and didn't fix.

2) Yes, always tried in new play test not an old save.

Update: Tried clean instance of YBEC and got the same crash but actor placement was correct, will look for alternatives to selecting targets just in case.

Update: I seem to have traced the issue to two blocks of code in YBEC and MCGC:

YBEC:
Code:
Yanfly.BEC.Window_BattleLog_displayActionResults =
    Window_BattleLog.prototype.displayActionResults;
Window_BattleLog.prototype.displayActionResults = function(subject, target) {
    if (Yanfly.Param.BECOptSpeed) {
      if (target.result().used) {
          this.displayCritical(target);
          this.displayDamage(target);
          this.displayAffectedStatus(target);
          this.displayFailure(target);
      }
    } else {
      Yanfly.BEC.Window_BattleLog_displayActionResults.call(this, subject,
          target);
    }
    if (target.isDead()) target.performCollapse();
};

MCGC:
Code:
//============================================================================
// Window_BattleLog
//============================================================================
// #region Window_BattleLog
Window_BattleLog.prototype.displayFailure = function (target)
{
    if (target.result().isHit() && !target.result().success && BattleManager._cardActions.length == 0 && BattleManager._cardTargetActions.length == 0)
    {
        this.push('addText', TextManager.actionFailure.format(target.name()));
    }
};
It seems these are redundant or something, notably with the "this.displayFailure(target);" portion.

Commenting this out prevents the game from crashing but cause it to lag for a very long time after each turn and fail to remove the block, same result no matter which I comment... I know just enough about scripting to see which block to comment out if I want to see what happens without that one bit.
if I see this bit, it look like MCGC is override the original core while YEP is aliasing it.
what happens if you alias the MCGC one to see if it than crash or not?

if it doesn't crash than, its the alias part.

however, I don't know what more is overridden and for what reason.
if I see this bit, it look like MCGC is override the original core while YEP is aliasing it.
what happens if you alias the MCGC one to see if it than crash or not?

if it doesn't crash than, its the alias part.

however, I don't know what more is overridden and for what reason.
Alright... As I said, I know just enough to comment out sections and see what happens as a result... Could you show me how to do that? I has a sneaking suspicion that even if that doesn't fix the issue properly, it may at least provide good data for the devs when I contact them.
before that... im coming back to this
setting the cards to card action fixed it so I have that for now, and I know what to report
you didnt try this?
you can try to comment out the point in there that sets the mentioned property's value to null or try setting it to an empty array instead of null
like, there should be a line in the plugin within BattleManager.createCardActionsActions that says BattleManager._cardTargetActions = null; or this._cardTargetActions = null; that you'd change from = null; to = [];
you shouldnt need to change anything on the card
before that... im coming back to this

you didnt try this?

like, there should be a line in the plugin within BattleManager.createCardActionsActions that says BattleManager._cardTargetActions = null; or this._cardTargetActions = null; that you'd change from = null; to = [];
you shouldnt need to change anything on the card
1) I really do wish I at least knew why that wasn't obvious to me to try, but I do actually need to be able to use the card target tag for some of the abilities to function correctly.

2) Changing the null to "[]" causes lag at the end of rounds which seems to last longer as the rounds go on... Also an empty text window keeps opening near the top of the screen for about 2 frames after a card is played. Screen shooting would be very difficult and may be unrelated.

3) The block not clearing at the start of rounds was my fault. I hadn't set an auto removal timer as I thought the addon handled that... I think I had some other bug that cleared it for me resulting in the mistakes canceling out or something.
2) Changing the null to "[]" causes lag at the end of rounds which seems to last longer as the rounds go on... Also an empty text window keeps opening near the top of the screen for about 2 frames after a card is played. Screen shooting would be very difficult and may be unrelated.
and this is independent from the change made prior?
Commenting this out prevents the game from crashing but cause it to lag for a very long time after each turn and fail to remove the block, same result no matter which I comment... I know just enough about scripting to see which block to comment out if I want to see what happens without that one bit.
youve reverted this change? right now, the .js file of the plugin youre using and all of its contents is the exact same as that of a fresh copy you would have gotten if you redownloaded it? (plugin parameters dont count)
and this is independent from the change made prior?

youve reverted this change? right now, the .js file of the plugin youre using and all of its contents is the exact same as that of a fresh copy you would have gotten if you redownloaded it? (plugin parameters dont count)
Yes, it's all back to the way I found it other than the 'null' being replaced with '[]'. The only issue that remains is this lag.
Yes, it's all back to the way I found it other than the 'null' being replaced with '[]'. The only issue that remains is this lag.
ok, just wanted to make sure. so it prevents the crash, but introduces lag.
I dont imagine you have an infinite recursive loop of some kind at the end of the turn, so unless the console is showing an error during that time, i dont really have any further suggestions other than to contact the devs.
ok, just wanted to make sure. so it prevents the crash, but introduces lag.
I dont imagine you have an infinite recursive loop of some kind at the end of the turn, so unless the console is showing an error during that time, i dont really have any further suggestions other than to contact the devs.
Ya, that plus this fact it may be the result of the other 1,000,000* things I did**. I'm gonna mark this one as resolved and open a new thread for that.

*I love to exaggerate.
**It's CGC where the player controls 3 entities rather than 1... It was always gonna have weirdness.

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/resolved-issue-yanfly-battle-engine-core.183785/