Dororo

Gespenst MKII pilot
Veteran
Joined
May 24, 2020
Messages
262
Reaction score
934
First Language
Italian
Primarily Uses
RMMV
I'm hitting a wall when inspecting the core scripts and so I can't quite progress into writing a plugin.

The informations I need are where TPBS functions are, as apparently they are somehow "entwined" inside default turn based combat and sparse around.
For example, I can't find where the timer for each battler reset to 0 after taking an action (or stop growing when full), or the global timer that determine the relative speeds.

Please direct me in the right way.
 

DoubleX

Just a nameless weakling
Veteran
Joined
Jan 2, 2014
Messages
1,829
Reaction score
977
First Language
Chinese
Primarily Uses
N/A
For example, I can't find where the timer for each battler reset to 0 after taking an action (or stop growing when full), or the global timer that determine the relative speeds.

Timer for each battler reset to 0:
Code:
BattleManager.endBattlerActions = function(battler) {
    battler.setActionState(this.isTpb() ? "undecided" : "done");
    battler.onAllActionsEnd();
    battler.clearTpbChargeTime();
    this.displayBattlerStatus(battler, true);
};

Game_Battler.prototype.clearTpbChargeTime = function() {
    this._tpbState = "charging";
    this._tpbChargeTime = 0;
};

Stop growing when full:
Code:
Game_Battler.prototype.updateTpbChargeTime = function() {
    if (this._tpbState === "charging") {
        this._tpbChargeTime += this.tpbAcceleration();
        if (this._tpbChargeTime >= 1) {
            this._tpbChargeTime = 1;
            this.onTpbCharged();
        }
    }
};

Game_Battler.prototype.onTpbCharged = function() {
    if (!this.shouldDelayTpbCharge()) {
        this.finishTpbCharge();
    }
};

Game_Battler.prototype.finishTpbCharge = function() {
    this._tpbState = "charged";
    this._tpbTurnEnd = true;
    this._tpbIdleTime = 0;
};

Global timer that determine the relative speeds:
Code:
Game_Battler.prototype.tpbAcceleration = function() {
    const speed = this.tpbRelativeSpeed();
    const referenceTime = $gameParty.tpbReferenceTime();
    return speed / referenceTime;
};

Game_Battler.prototype.tpbRelativeSpeed = function() {
    return this.tpbSpeed() / $gameParty.tpbBaseSpeed();
};

Game_Battler.prototype.tpbSpeed = function() {
    return Math.sqrt(this.agi) + 1;
};

Game_Battler.prototype.tpbBaseSpeed = function() {
    const baseAgility = this.paramBasePlus(6);
    return Math.sqrt(baseAgility) + 1;
};

Game_Unit.prototype.tpbBaseSpeed = function() {
    const members = this.members();
    return Math.max(...members.map(member => member.tpbBaseSpeed()));
};

Game_Unit.prototype.tpbReferenceTime = function() {
    return BattleManager.isActiveTpb() ? 240 : 60;
};

In short, you can try to search tpb(case-insensitive) in BattleManager, Game_Battler and Game_Unit :)
 

Dororo

Gespenst MKII pilot
Veteran
Joined
May 24, 2020
Messages
262
Reaction score
934
First Language
Italian
Primarily Uses
RMMV
Thank you @DoubleX , that's exactly what I asked for.
There's any award or medal that can be granted for such a complete and quick reply?

(and bash me hard to have miss that!)
 

Latest Threads

Latest Profile Posts

16 Hr Video Course on MZ? Huge DLC Pack from MZ's RTP Artist | RPG Maker News #110

I spent the past couple of days transferring my RM2K3 project over to RMMV. I upscaled everything 3x and it looks so cute I can't T_T
Small update on my random sprites sheet :kaoswt2:
cfcQKj8.png


Here's Azrael sprite with the fire weapon, hope it came out good.
A13774F4-298B-4F4D-B639-E6921E49FCC2.jpeg
Art test for a victory title screen change

Forum statistics

Threads
113,764
Messages
1,077,290
Members
147,802
Latest member
ariel638
Top