MZ Item that adds/subtracts TP

Hello,
I am creating a game in which I use TP as an additional parameter treated similarly to HP/MP.
I would like to be able to change TP with an item in the same way as, for example, a potion in relation to HP.
There is a “tp gain” command in the item options, but there is no way to decrease TP. The second problem with this option is that the item can be used even if we already have 100 TP.
I would appreciate some advice on how to create such an item.
Hi there!

Unless you use a common event, you will have to rely on a plugin to achieve that. As I can see, the Gain Tp on an item effect cannot be negative. And if you say that even with already full tp, the item can still be used, you would have to edit the code to prevent that.

With the common event, you could check the actor tp, if it is 100, then you do not recover it's tp with event commands, and instead, give him another tp item to trick the system so you don't lose the item.

In case he got less then 100 tp, then you just recover it with the event command.

The downside of this, is that RPG Maker will leave the menu scene to run the common event.

Not with time now, but if no one appears, maybe when I had some time I can write you a tiny code to handle this.
Thank you for suggesting the use of common event, but I encountered some problems:
- the TP command I found (RPG MAKER MV / MZ Script Calls spreadsheet) has the following form:
Code:
      target.gainTp(value);
Code:
(e.g. $gameActors.actor(3).gainTp(100);).
I would like the TP change to apply to any character who uses the item. This command causes TP to regain/lose the character whose ID is in the code.
- How can I check if the character's TP has not exceeded 100? I don't see an option to check TP in Conditional Branches.
Hi!

I think you can use a common event like that:
1759270879832.png

  • $gameParty.menuActor() → Will work to get the actor you used the item on the scene item.
  • $gameParty.menuActor().tpRate() === 1 → This is for the conditional branch. If this value is equal to 1, then the TP is at maximum value.
  • $gameTemp._lastActionData[1] → Will get the last item ID used. And with this, you can give the item back to the party.
  • $gameParty.gainItem(ItemObject, amount) → Will give the item object to the party with the specified amount.
As I said previously, this is a workaround. But I guess, without plugins, this is something you can do.
Thank you for the detailed explanation.
The method of returning item if TP exceeds 100 works great.
However, I have a problem with command “$gameParty.menuActor().gainTp(30)” - it only increases TP of the first character, even if item is used on another party member.
Thank you for the detailed explanation.
The method of returning item if TP exceeds 100 works great.
However, I have a problem with command “$gameParty.menuActor().gainTp(30)” - it only increases TP of the first character, even if item is used on another party member.
Its true! My bad!
Replace that script call with this one:
$gameParty.targetActor()
Now everything works perfectly, thanks!

Original thread: https://forums.rpgmakerweb.com/threads/item-that-adds-subtracts-tp.180356/