Rmmv add current max to to calculation

I have a plugin that is supposed to add tp each level. It's not. I understand why it's not, but need help editing it to do it correctly. I assume the creator never fully tested it.

Basically its
Mtp = math.ceil(this.level x (dynamic / 100)) + ((this._level - 1) x perlevel) + initial)

Where dynamic is percent of the current level, perlevel is a set gained each level and initial is your starting tp.

The base formula is based on 100% dynamic and 0 perlevel. With this formula mtp, or max to, is supposed to add your level amount to your max tp.

I start with 10 tp. At level 2, I gain 2 to. At level 3 I gain 3 to. Level 99 you gain 99 to. Right? Meaning, starting at 10, I should go 12, 15, 19 ect.

Well, this is not happening. Instead the formula is setting your max tp based on the calculation rather than adding to the total.

I see why and know why it's doing this. It takes the initial, and replaces your max tp based on your current level within the formula. Instead, I need it to do the same math, but add the total to the old total.

Does that make sense?

I want to assume I need to add a var. Like var currenttp = $actor.tp and then in the formula have initial and currenttp added to the total or something.

Any help would be great thank you!

Original thread: https://forums.rpgmakerweb.com/threads/rmmv-add-current-max-to-to-calculation.115489/