RMMZ Battle ends way too fast when using an alias.

Status
Not open for further replies.

Arctica

Veteran
Veteran
Joined
Jul 19, 2021
Messages
116
Reaction score
157
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,058
Reaction score
2,371
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
116
Reaction score
157
First Language
English
Primarily Uses
RMMZ
I'm dumb.... thanks again.
 
Last edited:

caethyril

^_^
Global Mod
Joined
Feb 21, 2018
Messages
3,058
Reaction score
2,371
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

I did a video review on Psychronic Games' Star Shift Origins, as they did a review on my game.
Check it out!
SF_People3_5 added!
index.php

Marketing seems to be about reducing dependence on luck to sell a product, as well as expanding the number of avenues in which luck can play a role in selling a product.
So, I've been wanting to do this randomized logic puzzle in my game for years now. I finally figured out how to do it by using arrays and a few small script calls. It's based on the Einstein Fish Puzzle! :D Though, I have no idea how to actually have the player put in answers.... might start a thread about it.

The projectiles shown in this video are as follows:
1, Basic Triple
2, 30-Degree Arc
3, Randomized Blast Wave
4, 8-way
5, 8-way Double
6, 8-way Slowness
7, 120-Degree Arc Repetitive
8, Projective Triple
9, Split 8-way
10, 2-way Split Randomized Arc
11, HP-MP Split Arc
12, Split Laser
13, Shock
14, Cosine

Forum statistics

Threads
118,632
Messages
1,117,444
Members
155,724
Latest member
tismasup
Top