Help with TP

So, I was following the instructions on this topic http://forums.rpgmakerweb.com/index.php?/topic/10216-what-influences-tp-ingame/

and wanted to change the TP into something that works like mana, where it will not increase with damage taken, and only has a max of 50.

When I try it in game, my TP is zero. What could I be doing wrong? Here is the code.

Game_BattlerBase

Spoiler
#--------------------------------------------------------------------------
# * Get Percentage of TP
#--------------------------------------------------------------------------
def tp_rate
@tp.to_f / 50
end
Game_Battler

Spoiler
#--------------------------------------------------------------------------
# * Initialize TP
#--------------------------------------------------------------------------
def init_tp
self.tp = 50
end
#--------------------------------------------------------------------------
# * Clear TP
#--------------------------------------------------------------------------
def clear_tp
self.tp = 0
end
#--------------------------------------------------------------------------
# * Charge TP by Damage Suffered
#--------------------------------------------------------------------------
def charge_tp_by_damage(damage_rate)
self.tp += 0 * damage_rate * tcr
end
Do your actors have the "Preserve TP" feature?

Without that feature the TP will be set to zero between battles, you have to add it either for the classes or for the actors (depending on who should have TP and who not).
I already have it for the classes, but do I need it for the actors also?
no, once should be enough.

Please test wether the actors can gain and hold TP by making a few skills that cause the actor to gain TP when used, make a skill that uses TP and then playtest a few battles. Do the actors gain TP when they're using that skill, and can they use the TP-Skill after that?

You need to find out where and why the TP doesn't function before we can help you solve the problem.
Ok, so items that give me TP work, but for some reason, my max TP at start is 70 instead of 50. TP using skills work fine, and so do TP gaining skills.
Bump. For some reason, my TP does not end at 50. I want it to have a max of 50, but the changes I did had no effect.
Bump. For some reason, my TP does not end at 50. I want it to have a max of 50, but the changes I did had no effect.
Default max TP is fixed at 100, and the script snippets in the first post do not show any change to max TP.

Can you post the script part where you changed max TP?
Game_Battler starting from line 728

#-------------------------------------------------------------------------- # * Initialize TP #-------------------------------------------------------------------------- def init_tp self.tp = rand * 25 end #-------------------------------------------------------------------------- # * Clear TP This only happens if Preserve_TP isn't used #-------------------------------------------------------------------------- def clear_tp self.tp = 0 end #-------------------------------------------------------------------------- # * Charge TP by Damage Suffered #-------------------------------------------------------------------------- def charge_tp_by_damage(damage_rate) self.tp += 50 * damage_rate * tcr endGame_battlerbase Line 491

Code:
  #--------------------------------------------------------------------------  # * Get Maximum Value of TP  #--------------------------------------------------------------------------  def max_tp    return 100  end
So I was play testing, and came across a problem. Apparently my character has 100 tp at the start of the game, and seems to regain all of it immediately after he uses a skill. This might be caused by sleeping in a bed (has the inn function). The max tp still isn't 50, and I have no idea what I need to change to make it that way. Changing the part "Initialize TP" had no effect. >:(

EDIT: Apparently this works for my party members, but not my main character. Weird.
To change the maximum TP, you have to change the function max_tp which is listed one post before your post about it (Game_Battlerbase line 491). No other change will affect the maximum TP, initialize TP is only for the starting values.
That would be under "Get Maximum Value of TP", right?

EDIT: I changed the part, and the max TP is now 50. Thanks for the help!

Original thread: https://forums.rpgmakerweb.com/threads/help-with-tp.17261/