Max TP Formula

This script allows you to set the max TP for each actor using a formula.

Max TP can be determined by the actor or by the class: if the actor has its own max TP formula, then the class formula is ignored. However, if the actor doesn’t have a formula, then the class formula is used.



Script: download here


In the script editor, place this script below Materials and above Main


Note-tag actors or classes with

<max tp formula: FORMULA>

Where the formula is a valid ruby expression that evaluates to a number.
You can use the following variables in your formula:

a – current actor
p – game party
t – game troop
v – game variables
s – game switches


Use the current battle turn count

t.turn_count * 10

Actor’s current level

a.level * 100

Party leader’s level

p.leader.level * 20

You may also like...

21 Responses

  1. FuzzyLizard says:

    Oh gosh, I hope you still check the comments of poor old Ace scripts 😛
    I really love this script, but it causes a troublesome problem with Items where it makes the “Gain TP _%” Recovery Effect in the Item Database no longer recover a percentage, but a flat value.

    For example, If I make a potion and give it a Recovery Effect of “Gain TP 100%”, it just adds 100 tp points, so my guy only recovers 100/500 TP, not 100% like it should have 🙁
    I think maybe the problem is that items still think that the Max_TP is the default 100.

    (Example screenshot in case I am garbo at explaining):

    There must be something in the Game Scripts that handles the Max_TP Gain formula for recovery items but for the life of me I can’t find it 🙁

    So is there any fix you can think of to make the “Gain TP _%” Recovery Effect in the Item Database actually use a real percentage?
    I’m really sorry to ask, you’re probably busy with MV these days but if this can be solved I’d appreciate the help so much! Otherwise my low, high, and full TP-Potions are borked 😛 Thanks in advance!

  2. rubydragon44 says:

    Are these appropriate additions to allow for enemy Max TP Formulas?
    #my edit
    class Enemy < BaseItem
    include TH::Max_TP_Formula
    #my edit
    class Game_Enemy < Game_Battler

    alias :th_enemy_max_tp_formula_max_tp :max_tp
    def max_tp
    return self.enemy.eval_max_tp_formula(self) if !self.enemy.max_tp_formula.empty?

    I know they work but I want to make sure they're good and aren't going to clash with default RPGMaker processes

  3. Shiori4me says:

    So what I tried in order to get it so that Max TP is 200 unless you're dead which then it's 100, was
    max tp formula: if a.state?(1); 100; else; 200; end;
    on Class 1's notebox
    And that just had it so that Max TP was 200 even if dead
    then I tried max tp formula: 200
    on the class notebox and
    ft: max_tp -100
    on State 1's notebox, and, again, Max TP was 200 regardless,
    then I tried
    max tp formula: / 2
    on state 1's notebox

  4. rubydragon44 says:

    How would you make it so that a state like death gives the user 0 TP?
    What I'm trying to do is have it so that MaxTP would normally be 200, and when you use a stimulant or the like, it heals you and raises 100 by 100, essentially putting you back at "100% TP" and that 50 TP or "50% TP" means exhausted.

    I know there is also

    But I can't get Max TP to drop below 0 and originally I was going to have it so that TP drops by 20% each turn when you're dead but I guess slips don't work with death or actor reserve

    • Hime says:

      This script sets the max TP. It doesn't "give" TP. I am not sure what you want to do from your description.

      • rubydragon44 says:

        Whoops. I meant that I can't set Max TP Below 100%.
        The functionality I'm trying to get is I wanted to make it so that when you have the state, Death, your Max TP becomes zero.
        {Or that when you have Death, your current TP becomes zero. Whichever.}
        Or… I could have it so that if you have the Death state makes your Max TP be 100, so that when you recover from death, you essentially are at regular energy levels.

  5. toastycheese says:

    Not quite. If you think of each TP as 1 bullet and each weapon having a different clip size then each weapon would have a different maximum TP, not just a different amount of used TP, though the use formula would also be useful

    • Hime says:

      This script assumes TP is determined by the actor. You can try this one which allows you to set the TP from various objects

      It doesn’t support formulas though.

      • digger says:

        It would be cool if you made more features for these scripts.
        It would be nice to have a formula for when using certain weapons or when having certain skills.
        IE: Your using a gun weapon with max tp set to 6 and uses 1 tp per use and certain skills would use more.
        Now you have a skill called; Gun Tinker (Which adds tp based on gun weapon formula) so the gun would have the basic formula plus a formula for how much extra tp is added. or it could be based on an accessory or something.

        • Hime says:

          This script is not suitable for that kind of situation, as it only provides a way to specify max TP using formulas. What you are looking for is a way to have equips determine max TP. You would need to make sure that you don’t gain TP through strange means (such as damage). Overall, it’s a very different system.

  6. toastycheese says:

    Would there be a way to easily extend these tags to Items and/ore Equipment? I think it would be vary useful in a system where, for instance, the TP function is used as an ammunition, so various weapons would have different TP formulas.

Leave a Reply

Your email address will not be published. Required fields are marked *