MV Issue Escape Command with YanflyBattleEngineCore

Hey there!

Having issues with Escape Command not working with YEP_BattleEngineCore.

Removed PartyCommandWindow (Fight/Escape menu) and decided to add escape option in Actor Command Window with this snippet(in a plugin):

JavaScript:
Window_ActorCommand.prototype.makeCommandList = function() {
      if (this._actor) {
          this.addAttackCommand();
          this.addCommand('Active', 'skill', true, 1);
          this.addItemCommand();
          this.addCommand(TextManager.escape, 'escape', BattleManager.canEscape());
      }
  };

Actor Command window right now contains:
Attack - Skill - Item - Escape

When using the escape command it gives an error of "Cannot read property slice of undefined"

Code:
YEP_CoreEngine.js:1098 TypeError: Cannot read property 'slice' of undefined
    at Function.BattleManager.createSetupActions (YEP_BattleEngineCore.js:2156)
    at Function.BattleManager.updatePhase (YEP_BattleEngineCore.js:2125)
    at Function.BattleManager.update (YEP_BattleEngineCore.js:1910)
    at Scene_Battle.updateBattleProcess (rpg_scenes.js:2265)
    at Scene_Battle.update (rpg_scenes.js:2257)
    at Scene_Battle.update (YEP_CoreEngine.js:1431)
    at Scene_Battle.update (YEP_BattleEngineCore.js:4551)
    at Function.SceneManager.updateScene (rpg_managers.js:2024)
    at Function.SceneManager.updateMain (rpg_managers.js:1983)
    at Function.SceneManager.update (rpg_managers.js:1907)

Turning OFF BattleEngineCore does make it work but disables all the functionality that I want from the plugin.
Not sure how to set up the correct flow for the escape with the plugin.

Plugins
1688134333974.png
I'm not certain exactly what path is being taken to arrive at that error, but Window_ActorCommand doesn't typically have a command with the escape symbol (usually it's in Window_PartyCommand). So you probably need to set the corresponding command handler, i.e. tell the game what to do when you pick "escape". Command handlers are usually added by the scene, e.g. add this to your plugin:
JavaScript:
void (function(alias) {
  Scene_Battle.prototype.createActorCommandWindow = function() {
    // do the usual things
    alias.apply(this, arguments);
    // then add a new handler for the "escape" command symbol
    this._actorCommandWindow.setHandler('escape', this.commandEscape.bind(this));
  };
})(Scene_Battle.prototype.createActorCommandWindow);

Also, rearrange your Yanfly plugins so they load in the recommended order, listed here:
In your case:
  • YEP_CoreEngine
  • YEP_MessageCore
  • YEP_BattleEngineCore
  • YEP_ItemCore
  • YEP_SkillCore
Make sure to save your project to apply Plugin Manager changes before testing.
The skill effect "escape" is not the same as the party command "Escape", which is where the distinction mentioned above comes from.
The skill effect is only supposed to be used on enemies for escaping and will remove only a single battler - sometimes to the püoint that when used on actors the battle continues even after all actors are removed (effectively freezing the game).
I'm not certain exactly what path is being taken to arrive at that error, but Window_ActorCommand doesn't typically have a command with the escape symbol (usually it's in Window_PartyCommand). So you probably need to set the corresponding command handler, i.e. tell the game what to do when you pick "escape". Command handlers are usually added by the scene, e.g. add this to your plugin:
JavaScript:
void (function(alias) {
  Scene_Battle.prototype.createActorCommandWindow = function() {
    // do the usual things
    alias.apply(this, arguments);
    // then add a new handler for the "escape" command symbol
    this._actorCommandWindow.setHandler('escape', this.commandEscape.bind(this));
  };
})(Scene_Battle.prototype.createActorCommandWindow);

Also, rearrange your Yanfly plugins so they load in the recommended order, listed here:
In your case:
  • YEP_CoreEngine
  • YEP_MessageCore
  • YEP_BattleEngineCore
  • YEP_ItemCore
  • YEP_SkillCore
Make sure to save your project to apply Plugin Manager changes before testing.

Perfect! Worked like a charm.

Thread can be closed!
Great! 😂

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.

In future, note that you can use the Report button to let the mod team know that you want your thread closed. We won't necessarily see a comment/post, but we will see a report~

Original thread: https://forums.rpgmakerweb.com/threads/issue-escape-command-with-yanflybattleenginecore.158838/