MZ Remove a player from battle within Common Event

I have an enemy skill called "Protein Loading" in which the enemy eats the player and removes them from battle. I have an action sequence in a Common Event which does this. The skill has an Effect: Special Effect: Escape to remove the target, which is activated in the Common event with this code:

◆Plugin Command:VisuMZ_1_BattleCore, MECH: Action Effect
:Plugin Command:Targets = ["current target"]

It all works well, with one slight problem: the Escape effect plays the running away sound, which doesn't make sense in this context. Is there a workaround? Even muting the escape sound briefly would work.
  • I don't want to remove the target with Death because I want them to have the same HP as when they were eaten after the battle, and I don't want them to be affected by spells. I want them gone from battle.
  • I don't want them gone from the party after battle
  • I just want them removed from the current battle, and not return during the battle
I guess just make it switch dependent (save as .js file and add as a plugin). Now you can turn on a switch X if you don't want the sound to play.

Game_Battler.prototype.escape = function() {
if ($gameParty.inBattle()) {
this.hide();
}
this.clearActions();
this.clearStates();
if (!$gameSwitches.value(X))
SoundManager.playEscape();
};
Thanks, that did the job.

What is the purpose of this.clearActions() and this.clearStates()? Is it to remove states so they don't persist after battle?

I guess just make it switch dependent (save as .js file and add as a plugin). Now you can turn on a switch X if you don't want the sound to play.

Game_Battler.prototype.escape = function() {
if ($gameParty.inBattle()) {
this.hide();
}
this.clearActions();
this.clearStates();
if (!$gameSwitches.value(X))
SoundManager.playEscape();
};
Yeah clearStates() removes the states and clearActions() removes the actions. I haven't checked at what points it has checks for if a character is escaped, but I guess without clearing the actions it would continue the attacks after you escaped, if you for example had a dude who acts twice and escaped on the first action. Also some conditional checks might check for the actions. Or maybe it's just done for safety's sake.

Original thread: https://forums.rpgmakerweb.com/threads/remove-a-player-from-battle-within-common-event.181363/