Cannot control TP at start of battle

Using 1.02a version on steam.

Line 726 of Game_Battler has the line to control TP at battle start, but nothing I do to this value will change it.

I've been trying to get TP to start at 100, but actually changing the default of rand * 25 to anything else yields no results.

Actually, setting self.tp = 100 crashed the game about 1/15 battles.

#===============================================================================# name: easy TP access# code snippet by Elise-Chan# allows easy access to TP control#===============================================================================module ELISE_CHAN#===============================================================================# start configuration#===============================================================================MAX_TP = 100 #MAX amount of TP that your characters may haveSTART_TP = 0 #starting TP, default = 0.MODE_SET = false #[true = always start with the value from START_TP]#[false = gives a random amount of TP between the values of START_TP# and MAX_VALUE]MAX_VALUE = 25#===============================================================================# end configuration#===============================================================================end#===============================================================================class Game_BattlerBaseinclude ELISE_CHANdef max_tpreturn MAX_TPend #classend #defclass Game_Battler < Game_BattlerBaseinclude ELISE_CHANif MODE_SET == truedef init_tpself.tp = rand && START_TPend #ifelsif MODE_SET == false@tp = rand * MAX_VALUEendend#===============================================================================I tried sticking this script in underneath the Game_Battler script, but no dice. I obviously edited it to 'start' at 100, but I'm not sure if I stuck it in there right.
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


When you post code, please use code tags, as it keeps the formatting and makes scripts easier to read.
For custom scripts, you should place them below Materials and above Main, not inside one of the engine's scripts.
Isn't this

self.tp = rand && START_TPgoing to return a bool value? x && y will be true or false, not a number.
Why don't you just make it

Code:
self.tp = max_tp
?
There is another way to solve this without scripting:

Give each actor the feature "preserve TP" and they will not start with random TP, but with the amount left from last battle.

If you want to start by 100, simply add an event command to increase the TP of all actors after each battle.

(this preserve-feature might also be the reason why the TP doesn't work as intended, because it switches the TP behaviour for the actor)
I'm an idiot. You have to save the game before changes in the script will take effect.
So, solved then?
Absolutely, and thank you for your help. I assumed that hitting apply on the script page would apply it.
Are you doing a battle test? Normally when you go to play your game, it'll ask you if you want to save. It doesn't do this when you do a battle test though. So you'd either have to be doing that, or actually telling it you don't want to save.


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/cannot-control-tp-at-start-of-battle.20465/