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 Profile Posts

Another comic with Backstage Malak...
If you want to ask him anything, you can ask on my DeviantArt page! I'm not sure if you're allowed to do it here.
Forum tip of the day ...
If you get a temporary suspension for being a jerk to people who are trying to help you, and arguing with mods and admins, don't go making new accounts. Chances are, if you p**s us off enough to suspend you for a week, we're not going to hesitate giving you a permanent ban when you give us a reason.
E_6fAErVkAQILXu.png
I'm so close to releasing my game on steam! :blush::blush::blush:
Us:
"This game is awesome! I wish there are more games like this in the future."
Also us:
"I hate how games stopped being original and start copying other successful games."
Should've done this a few days ago but...
PRI_200136808.jpg
Rest in Peace, Sir Clive Sinclair
1940 - 2021
Entrepreneur, Technologist, Father of the Modern British Computing Industry, and protagonist of Legend of ZUN.

Without you, England's games and tech industry wouldn't be where it is.

Forum statistics

Threads
115,287
Messages
1,088,660
Members
149,913
Latest member
badalias
Top