2 questions about controlling TP gain/loss

Hello everybody! It's my first post here 🙂 I've been stalking the forums for some time but never posted anything before.

Disclaimer: I'm using Yanfly's Party and battle systems, Skill cost Manager, SKill restrictions and TP manager.

In my current project, I am using a custom TP system called insanity. The idea is that when you have too much of it, bad things happen. There are two things I need help with:

1) I want to modify Insanity gain/loss based on current party in combat. It will be easiest to explain with an example:

Let's say we have actors A, B and C. A and B like chocolate, C likes fruits. If you put all of them together in a single party, C gains insanity every turn during combat. If you only put A and C together, nothing happens as they balance each other out.

My idea to achieve this was to have a variable, let's call it X for now, that changes depending on active party. It's 0 by default. Adding A or B increases the variable by 1. Adding C decreases it by 1.

Now, let's look at the actors. A and B have if X < 0, then they have [TRG] + 5 (they slowly become insane). Meanwhile, C has the opposite, if X > 0, then he has [TRG] + 5 (he becomes insane instead).

===============================================

The above is just an idea though, I lack necessary experience to implement this and I could use some help :/

Additionally, I sense a problem with Yanfly's party system, since it allows you to have any amount of characters follow you and you only pick a few to accompany you in combat. And I want this system to be based on current party formation in combat, not all actors that follow you.

I would also like this system to be specific to certain actors (or classes, either way works tbh), not the general populi.

2) This is a much simpler question. During combat, how can I have specific effect take place once insanity reaches certain threshold?

Example: Let's say that I want actor A to become disobedient once his insanity is >= 80. So every time it's his turn in combat, if he's above the threshold, he has a 50% chance to attack any random target (including allies) on its own, without accepting orders.

How do I set up a system that checks A's insanity every turn and then causes the above to happen?

I'm sure someone wrote a guide about this but I searched for a long time to no avail :/ Maybe I'm not good at searching but I could still use your help. Oh btw, auto-combat is a no-go, as I don't think it ever targets allies.

Thank you to everyone who took their time to read this post 🙂

For those wondering - I have some experience with vx ace but so far I only ever used it for small projects without any fancy ideas, to warm myself up. So while I'm not a total noob, I don't have a lot of practice either.
#2 can be done with Victor Sant's State Auto Apply script.

#1 would best be done with a custom script; you should make a request or commission someone to script it for you.  (It could theoretically be done with eventing plus a single script line, but this would be much less efficient.)
Thanks for the reply, I'll look into the state auto apply thing 🙂 Hopefully it won't interfere with Yanfly's scripts I'm using.

I'll also have a look at the script forums to see if there's a chance someone may do it for me. Otherwise, I guess I'll try doing it myself though I'm not terribly extatic about that lol

Original thread: https://forums.rpgmakerweb.com/threads/2-questions-about-controlling-tp-gain-loss.39833/