Setting enemy TP at start of battle

I know that there's a small change to a default script which allows you to set how much TP the enemy has at the start of battle.  Unfortunately I have lost my file of useful information like that.

Can anyone please tell me what the alteration is?

Thanks.
Initial TP is determined by the init_tp method in Game_Battler. If you want it to be different for enemies, you could do something like this:

class Game_Battler < Game_BattlerBase

  def init_tp

    if self.is_a?(Game_Actor)

      self.tp = rand * 25

    else

      self.tp = whatever you want enemy tp to start at

    end

  end

end
Whatever it was I did in the past it wasn't that, so just to be clear - this is a new snippet? Or an insertion into a default script?
Whatever it was I did in the past it wasn't that, so just to be clear - this is a new snippet? Or an insertion into a default script?
I think it's a separate snippet, although you can also edit the corresponding part directly, if you know how.

Another way is to use a script call in a battle event being run at the start of a battle:

$game_troop.members.each { |member| member.tp = x }Where x is the starting tp amount.

Setting different tp for different enemy can be done via this:

Code:
tp = [x1, x2, x3, ..., xn]$game_troop.members.each { |member| member.tp = tp[member.index] }
Thanks for the clarification - and thanks twice over for mentioning how to set different tp for different enemies.  That opens up a lot of additional possibilities.
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/setting-enemy-tp-at-start-of-battle.39517/