RMMZ Battle ends way too fast when using an alias.

Status
Not open for further replies.

Arctica

Veteran
Veteran
Joined
Jul 19, 2021
Messages
159
Reaction score
256
First Language
English
Primarily Uses
RMMZ
Here is the original method:


JavaScript:
BattleManager.checkBattleEnd = function() {
    if (this._phase) {
        if (this.checkAbort()) {
            return true;
        } else if ($gameParty.isAllDead()) {
            this.processDefeat();
            return true;
        } else if ($gameTroop.isAllDead()) {
            this.processVictory();
            return true;
        }
    }
    return false;
};
When this runs and the result is of everyone being dead, you'll see a message that the party was defeated, yadda yadda, and then the screen fades and the game is closed(in the case of battle testing).

However when it's aliased, the process is sped up and you don't even see the defeat message before the game is closed. It doesn't matter if nothing else is added in the function body and just allow the game to run the original code:
JavaScript:
(function(alias) {
    BattleManager.checkBattleEnd = function() {
        alias.apply(this);
        
    };
})(BattleManager.checkBattleEnd);

I want to know how to have it end the battle at its original pace(if that makes sense) and yes I need to change the behavior of that method, preferably not having to rewrite the method.
 

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,529
Reaction score
2,656
First Language
EN
Primarily Uses
RMMZ
That method should return a value, so remember to include a return statement:
JavaScript:
(function(alias) {
    BattleManager.checkBattleEnd = function() {
        return alias.apply(this);
    };
})(BattleManager.checkBattleEnd);
 

Arctica

Veteran
Veteran
Joined
Jul 19, 2021
Messages
159
Reaction score
256
First Language
English
Primarily Uses
RMMZ
I'm dumb.... thanks again.
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,529
Reaction score
2,656
First Language
EN
Primarily Uses
RMMZ
It's an easy mistake to make, no worries! :kaohi:

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.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

Current status screens for Shadows of the Earth: The Vrila'an Legend. Need to do something about the color scheme lol
Captura de pantalla (259).pngCaptura de pantalla (260).png
My first serious victim in game hacking - Pawnbarian.
Diana Path 2.png
I love these two design wise lol... The high school principal and the captain of the women's wrestling team. they team up as bosses to save the school's accreditation.
Kanori24 wrote on TheRamenGirl's profile.
I love your profile pic. Definitely one of my favorite scenes from OPM :D

Forum statistics

Threads
122,074
Messages
1,146,309
Members
160,360
Latest member
bleach
Top