Jul 31, 2016
Reaction score
First Language
Primarily Uses

Can Lose 1.0

By Tairo



Changes the default lose behavior from game over to just continuing. (i.e. Makes all battles act like an event battle with the "Can Lose" box checked).



- All losses continue game by default (Plug and Play)

- You can choose a common event to run after each loss, and easily change it on-the-fly using commands.

- A switch can be used to determine the default loss behavior (either continue the game, or normal RPG Maker behavior).


How to Use

Add it to your plugins folder (file name: CanLose.js).


(Optional) Enter the ID of the common event you want to run by default and the ID of the switch you want to use as parameters, or enter in 0 if you don't want to use one (or either) of them.


Plugin Commands

Makes losing the current battle result in a game-over.

CanLose false          # Makes it so a loss causes the game over event

Makes losing the current battle just continue the game (to undo the previous command, if desired).

CanLose true           # Makes it so a loss does not cause a game over

Changes the ID of the common event to run after a loss.

CanLose eventID 2      # Sets the event ID to 2, and prints in the console

Returns the ID of the switch used as a parameter, and prints it's value into the console (if one is selected).

CanLose checkSwitch    # Returns ID of the switch & prints it in the console



Download from Dropbox


Plugin Code

Download from pastebin

				// Can Lose
				// by Tairo
				// Last Updated: 2016.8.17
				 * @plugindesc Allows player to lose all battles, including random battles, with no game over.
				 * @author Tairo
				 * @param Lose Common Event
				 * @desc The ID of the common event you want to run after each lost battle.
				 * @default 0
				 * @param Allow Game Over Switch
				 * @desc Switch ID to turn on and allow a game over (on = default RPG Maker behavior).
				 * @default 0
				 * @help
				 * ============================================================================
				 * How To Use
				 * ============================================================================
				 * This plugin causes all battles (random or event) to not cause a game over
				 * event after a loss, by default. No commands or parameters needed for the
				 * basic function, they're just for more control.
				 * The plugin is designed for those who wish to allow the player to lose a
				 * random encounter, just like an event battle.
				 * The first parameter also allows you to run a common event after a loss, or use
				 * a value of 0 to have no common event run.
				 * The second parameter is a switch for if you want to control the default
				 * behavior. Off for no game over default, on for normal RPG Maker behavior.
				 * Use 0 if you don't want to use a switch, so it always allow losses.
				 * The plugin commands are for when you want to change whether or not a game
				 * over will occur upon a loss in the middle of a battle, or to make certain
				 * troops/encounters (like bosses) cause a game over if lost to.
				 * Plugin Command:
				 *   CanLose false          # Makes it so a loss causes the game over event
				 *   CanLose true           # Makes it so a loss does not cause a game over
				 *   CanLose eventID 2      # Sets the event ID to 2, and prints in the console
				 *   CanLose checkSwitch    # Prints current value of the switch in the console
				 * ============================================================================
				 * Terms Of Use
				 * ============================================================================
				 * Free to use and modify for commercial and noncommercial games, with credit.
				 * ============================================================================
				 * Credits
				 * ============================================================================
				 * Tairo
				(function() {
				    var parameters = PluginManager.parameters('CanLose');
				    var loseEvent = Number(parameters['Lose Common Event'] || 0);
				    var allowSwitch = Number(parameters['Allow Game Over Switch'] || 0);
				    var _BattleManager_setup = BattleManager.setup;
				    BattleManager.setup = function(troopId, canEscape, canLose) {
				        if(allowSwitch == 0 || $gameSwitches.value(allowSwitch) == false) {
				            _BattleManager_setup.call(this, troopId, canEscape, true);
				        else {
				            _BattleManager_setup.call(this, troopId, canEscape, canLose);
				        this._canEscape = canEscape;*/
				        //this._canLose = true;//canLose;
				    var _BattleManager_processDefeat = BattleManager.processDefeat;
				    BattleManager.processDefeat = function() {
				        if (loseEvent !== 0) {
				    var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
				    Game_Interpreter.prototype.pluginCommand = function(command, args) {
				        _Game_Interpreter_pluginCommand.call(this, command, args);
				        if (command === 'CanLose') {
				            switch (args[0]) {
				            case 'false':
				                BattleManager._canLose = false;
				                console.log("Current fight will cause game-over if lost.");
				            case 'true':
				                BattleManager._canLose = true;
				                console.log("Current fight will not cause a game-over if lost.");
				            case 'eventID':
				                loseEvent = Number(args[1]);
				                parameters['Lose Common Event'] = Number(args[1]);
				                console.log("Event in Parameter: " + parameters['Lose Common Event'] + " & Event in code: " + loseEvent);
				            case 'checkSwitch':
				                return allowSwitch;
				                console.log("Switch " + allowSwitch + " is " + $gameSwitches.value(Number(parameters['Allow Game Over Switch'])) + " " + $gameSwitches.value(allowSwitch));
				  /* This function can be found in rpg_managers.js
				    BattleManager.setup = function(troopId, canEscape, canLose) {
				    this._canEscape = canEscape;
				    this._canLose = canLose;



Q: Do I have to use the plugin commands?

A: No, they are not needed for the basic function of making all battles act as though you checked the "Can Lose" box on an event battle. In that sense, it's sort-of 'plug-and-play'. However, the commands do allow more customization/control, like easily making certain fights (like bosses) or even skills change the behavior (like maybe an assassin's 'kill' ability, or something).


Q: Why not flip a switch after a loss, instead of limiting it only to a common event?

A: There is already another plugin which does that (along with any other result of a battle), which is Battle Result Switches by Shaz (click for his forum post), but his plugin doesn't allow lost battles to random encounters. The reason for me just using common events is to differentiate my plugin from his, and because you'd probably only use a common event for most scenarios where you'd want the player to not game-over after a lost battle anyway.


Credit and Thanks

- Tairo


Terms of Use

Free for commercial and non-commercial use, with credit.
Last edited by a moderator:
Feb 3, 2020
Reaction score
First Language
Primarily Uses
Your example project works but I have set up everything in my project and it doesnt do anything. I checked that I did everything correctly and I even turned off every other plugin and it doesnt work


Dec 16, 2016
Reaction score
First Language
Primarily Uses
1. Did you set up the plugin parameters?

2. And included common events-

3. when troops called upon or a plugin command?


Note: There are two other events in the demo which you can copy and paste to your MV Project in map editor.

It takes a bit of time to set up. I confirm that this does work with latest version of MV.
Last edited:

Latest Threads

Latest Profile Posts

I finally decide, after several ppl asking me to, to create a gamethread about project M... And my internet craps out on me halfway through the process :(
making my first game is like trying to stuff all my experience with old games into one
so its slow and painful when i dont get it right... i bet the next game is gonna be finished earlier!
When you don't find any time to work... :kaocry:
First Ten Minutes of my Caretaker inspired game

Finally, I got a good Gmail message [from smg5urded]
"This game does look a bit plain, but, I'm sure this does not destroy the experience as a whole. Monsters fit your style of game-play, mapping looks crude but I'm sure you can make it better if you do a remake of Forgotten Eclipse"

Forum statistics

Latest member