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,832
Reaction score
980
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 Posts

Latest Profile Posts

Jeżeli jeszcze nie subskrybujecie to byłoby nam bardzo miło.
1.png
Potrzebujemy 100 subów na niestandardowy URL.
Who wants to see my review of the worst star wars movie? This movie has all the excitement of being on Jury Duty of the most boring case ever about trade negotiations.
A lot to learn to make a game. Can I handle it?
I've been working on status effects since last thursday, and today I finished the core mechanic of Zombie, Teleport, Curse and Recall. Zombie and Curse are lacking a few things to make them complete atm. Teleport though is the "HAHA" spell for some of my mobs, but can "NOPE" at them with Recall.
I'm weird as there are a few game franchises I'll watch and read about, but have no interest in playing.

Forum statistics

Threads
115,158
Messages
1,087,724
Members
149,702
Latest member
Hidemitsu
Top