Battle end when a party member loses

EmmaB

Veteran
Veteran
Joined
Feb 20, 2018
Messages
47
Reaction score
57
First Language
English
Primarily Uses
RMMV
Hi everyone,

I'm new to the forums, so I hope I've placed this thread in the right place. I am trying to make a game for the RPG birthday event, but I've run into a problem. I am wanting to make it that, if any of your party members lose in battle, it ends the game (game over).

Any ideas as to what I should do? I've tried a few things but none of them have worked.
 

The Mighty Palm

Resident Palm Tree
Restaff
Joined
Jan 29, 2015
Messages
566
Reaction score
4,027
First Language
English
Primarily Uses
N/A
Quite simple, really.
You just need to make a battle event in the troop trees with the condition set to Actor HP = 0. Make one tab for each character. Also set it to Moment so that it happens instantly.
It'll look something like this:
 

Nolonar

Veteran
Veteran
Joined
Feb 18, 2018
Messages
106
Reaction score
114
First Language
French, German
Primarily Uses
RMMV
If you need this for every battle, you can use a plugin.
Here's one I wrote just now (haven't tested it):

Code:
(function() {
BattleManager.checkBattleEnd = function() {
    if (this._phase) {
        if (this.checkAbort()) {
            return true;
        } else if ($gameParty.deadMembers().length) {
            this.processDefeat();
            return true;
        } else if ($gameTroop.isAllDead()) {
            this.processVictory();
            return true;
        }
    }
    return false;
};
})();
If any member dies in any battle, the battle is lost.
Normally, this means a game over, unless the battle was started through an event and you chose "can lose".
 

EmmaB

Veteran
Veteran
Joined
Feb 20, 2018
Messages
47
Reaction score
57
First Language
English
Primarily Uses
RMMV
@The Mighty Palm Thanks for the quick reply. I am using side view battle and when I do that, it doesn't do the normal battle loss like when your whole party loses (character that lost falls over, collapse SE sound plays and defeat ME plays). I wanted it to look the same as when you lose normally.
@Nolonar Thanks for that. How do I save it as a plugin? (Sorry, I'm new to this)
 

Nolonar

Veteran
Veteran
Joined
Feb 18, 2018
Messages
106
Reaction score
114
First Language
French, German
Primarily Uses
RMMV
In your project folder there should be a "js" folder. Inside it, there's a "plugins" folder.
You can create a ".js" file and put the code inside. The simplest way is to make a copy of an existing ".js" file, open the copy with Notepad (or Notepad++) and replace its content with the code (don't forget to save and rename your file).

In RMMV you need to open the plugin manager (it's the button with the jigsaw icon).
The plugin manager should have a couple of basic plugins listed. If you click below the last plugin, the empty row should be highlighted.
Just double click that empty line to open the plugin selection window.

There is a selectbox under "Name:" where you'll select the plugin (do you still remember the file's name?)
Make sure "Status:" is "ON".
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I was planning to release a useless plugin for april fools, but then I thought I let it be.
Tfw every dev around me is using Live2D in their MV games and make me question my skills repeatedly.

Spending the day reworking my maps, especially the first "biome". This time it's not even in the dark. :LZSwink:
Activity on the forums has increased lately, probably because of people staying home. The amount of work for moderators has increased lol.

Forum statistics

Threads
95,522
Messages
929,783
Members
125,791
Latest member
Oersted_LAL
Top