MZ Help changing item function/ TP related [solved]

Hello, back again looking for a bit of help!

So previously i managed, with help, to change the function of TP to essentially only be gained by taking damage and causing a status condition when it reaches 100.
However when trying to make items to remove or reduce TP, i realize it only lets you gain TP. So i tried messing around with the plugin (just a copy of rmmz_objects) i used to change the function of TP and i don't know how to apply values. I'm not sure what I'm needing to change.

Also, i tried changing this code
Game_Action.prototype.itemEffectGainTp = function(target, effect) {
let value = Math.floor(effect.value1);
if (value !== 0) {
target.GainTp(value);
this.makeSuccess(target);
}

To
Game_Action.prototype.itemEffectDecreaseTp = function(target, effect) {
let value = Math.floor(effect.value1);
if (value > 0) {
target.DecreaseTp(value);
this.makeSuccess(target);
}
};

};

But it didn't seem to change anything. I guessing it's only checking if TP is greater than zero and just doing what it did previously if it is.
target.DecreaseTp
DecreaseTp() isnt a battler function. Tp reductions are done by running gainTp() with a negative value
DecreaseTp() isnt a battler function. Tp reductions are done by running gainTp() with a negative value
How would i do that? Do i just put a negative behind the 0?
Go back to the original function and put a negative sign in front of the "value" inside the gainTp call
Go back to the original function and put a negative sign in front of the "value" inside the gainTp call
Huge! Thank you so much!! Sorry if it seemed like a simple question. I just have never been able to fully grasp code language.
I just have never been able to fully grasp code language.
I suggest following a tutorial such as w3school's JS tutorial before making edits to the engine. Trying to alter functions without knowing the basics will only will cause more errors than necessary in the future

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/help-changing-item-function-tp-related-solved.179005/