HiddenAlchemist

Veteran
Veteran
Joined
Jan 6, 2021
Messages
131
Reaction score
186
First Language
English
Primarily Uses
RMMV
So a little while ago I devised a simple system using Yanfly's BuffStateCore, StateCategories, and AutoPassiveState where anytime a character's TP reaches the maximum 100, that character recovers from various status ailments and a small animation plays to indicate that TP is now maxed.

With these plugins, I've created a passive state that checks if the character's TP is maxed at the start of their turn before proceeding to recover and play the animation.

Previously I've achieved this using events before, however both events and plugins have the same issue: The passive state will still recover and play the animation every action so long as the character's TP remains at 100. I would rather have it where the passive state only goes into effect once, preferably at the very moment the character's TP is maxed. And so that way it won't repeat the same effect until the character's TP is depleted and maxed out again.

The notetags I have for the passive state is:
Code:
<Category: Bypass Death Removal>
<Category: Bypass Recover All Removal>

<Custom Action Start Effect>
if (target.tp >= 100) {
// Play the animation on target.
target.startAnimation(49);
// Remove negative states.
target.removeState(4);
target.removeState(5);
// Clear the target's results.
target.clearResult();
}
</Custom Action Start Effect>

There does not appear to be any issues with this passive state outside of battle. The actors still keep their negative status ailments even when TP is full. But if there are any other potential conflicts with it I'm missing, it'd be good to be informed of them too.

So is there a more efficient way of achieving this effect where it only happens once? Or is there another plugin out there or some other sort of workaround that I should look into instead? Thanks.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,629
Reaction score
5,398
First Language
English
Primarily Uses
RMMV
The trick is that passive states don't support doing something as soon as they're activated. The closest you can do is how you have it set up as a Custom Action Start or something similar (I think Turn Start would work better, but whatever you like best).

As far as making it only happen once, you'll have to use something to track that the effect has activated. You can do this in any number of ways...each actor having a switch, adding a variable to the actors, or I'll give you an example using a second state.

So you'll have state X, which is what you currently have set as your passive state on the actors. In that state, do:
Code:
<Custom Action Start Effect>
if (user.tp>=100 && !user.isStateAffected(Y))
    user.addState(Y);
</Custom Action Start Effect>

Then in state Y:
Code:
<Custom Apply Effect>
// all your stuff from above
</Custom Apply Effect>

<Custom Conclude Effect>
if (user.tp<100)
    user.removeState(Y);
</Custom Conclude Effect>
 

HiddenAlchemist

Veteran
Veteran
Joined
Jan 6, 2021
Messages
131
Reaction score
186
First Language
English
Primarily Uses
RMMV
Then in state Y:
Code:
<Custom Apply Effect>
// all your stuff from above
</Custom Apply Effect>

<Custom Conclude Effect>
if (user.tp<100)
    user.removeState(Y);
</Custom Conclude Effect>
Forgive me if I'm not following everything you mean. You are suggesting making another state that removes the passive state?

Cause that's not really the issue here, I think. The state that routinely checks the TP amount is a permanent passive state that cannot be removed. And secondly, there doesn't need for there to be a "removeState(Y)" state. Because once an actor's TP has dropped from 100, the repeated effect does stop.

I guess to better illustrate the problem I'm trying to figure out here:
  • An actor's TP reaches 100, whereupon the passive state that checks for TP goes into effect.
  • The animation plays and any negative status ailment is removed.
  • However on their turn, rather than the actor using a skill that depletes TP, they choose to attack physically or guard. Their TP remains at 100 unchanged.
  • On their next turn, the animation again plays and they again recover from any new ailments if received, because their TP stayed at 100. And this will keep repeating every turn so long as their TP remains maxed and unchanged. Not only does this get very repetitively redundant, but it can also be exploited too.
However, your suggestions for a secondary state and using switches does give me a couple ideas that may be worth looking into. I'll try that sometime to see if that will work any better. If you have any other thoughts, I'd love to hear them.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,629
Reaction score
5,398
First Language
English
Primarily Uses
RMMV
Forgive me if I'm not following everything you mean. You are suggesting making another state that removes the passive state?
No, that is not what my post said. It removes state Y, your passive state is X.
However on their turn, rather than the actor using a skill that depletes TP, they choose to attack physically or guard. Their TP remains at 100 unchanged.
On their next turn, the animation again plays and they again recover from any new ailments if received, because their TP stayed at 100. And this will keep repeating every turn so long as their TP remains maxed and unchanged.
That is exactly what I gave you a solution for. Please try following the instructions I typed out for you and see if it works.

You take the recovery effects out of your passive state and put them into another state that runs it as a Custom Apply Effect - that means it will only activate once when it's first put onto the actor. Any turns you remain at 100 TP it will do nothing because you already had the state.
 

HiddenAlchemist

Veteran
Veteran
Joined
Jan 6, 2021
Messages
131
Reaction score
186
First Language
English
Primarily Uses
RMMV
No, that is not what my post said. It removes state Y, your passive state is X.

That is exactly what I gave you a solution for. Please try following the instructions I typed out for you and see if it works.
I apologize again for misreading your response. As well for my lack of tact in mine; I do appreciate your help all the same. I can understand your annoyance, though I will ask you to please lighten your tone. Misunderstandings do happen.

I've now had more time to implement the notetags. And unfortunately, the ones posted above didn't work in stopping the repeated effect. However, following your suggestion of using variables or switches, I was able to get this to mostly work using a variable:

Passive State X:
Code:
<Category: Bypass Death Removal>
<Category: Bypass Recover All Removal>

<Custom Action Start Effect>
if (user.tp>=100 && $gameVariables.value(1) == 0)
    user.addState(13);
</Custom Action Start Effect>

State Y:
Code:
<Custom Apply Effect>
// Play the animation on target.
target.startAnimation(49);
// Remove negative states.
target.removeState(4);
target.removeState(5);
// Actor1 TPCheck Variable
$gameVariables.setValue(1, 1);
</Custom Apply Effect>

<Custom Conclude Effect>
if (user.tp<100)
    $gameVariables.setValue(1, 0);
    user.removeState(13);
</Custom Conclude Effect>

Now, State X works just fine as intended. It goes into effect after the actor reaches 100 TP both in and out of battle and there are no more repeated effects thanks to the variable. But there's now an issue with State Y (ID 13).

For some reason after State Y finishes its apply effect, the state is immediately removed even while the actor's TP is still at 100. It's strange though because it's not the conclude effect that removes it; when Passive Y is immediately removed, variable 1 stays at a value of 1. So if I do use a skill to deplete TP, then bring back it back to 100, State X no longer goes into effect because variable 1 still has a value of 1. I don't think State Y is even reading or recognizing the custom conclude effect,
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,629
Reaction score
5,398
First Language
English
Primarily Uses
RMMV
I can understand your annoyance, though I will ask you to please lighten your tone. Misunderstandings do happen.
I had no tone. I told you that what you typed wasn't what my post said, and that you should try implementing the solution before telling me it didn't work. I said nothing derogatory to you - I even took extra time to type an explanation of the solution I already gave you. I'll ask you not to project emotional connotations into my neutral words, but I'll give you one last bit of advice:
<Custom Conclude Effect>
if (user.tp<100)
$gameVariables.setValue(1, 0);
user.removeState(13);
</Custom Conclude Effect>
I have no clue why you'd need to use two states and a variable, but that code doesn't do what you think it should.

A conditional statement (if/else) automatically applies to the next single statement of code. If you want to do more than one thing relying on that condition, you need to put it in braces. This is going to remove state 13 at the end of every action regardless of the user's TP.
Code:
<Custom Conclude Effect>
if (user.tp<100)
{
    $gameVariables.setValue(1, 0);
    user.removeState(13);
}
</Custom Conclude Effect>

Good luck.
 

HiddenAlchemist

Veteran
Veteran
Joined
Jan 6, 2021
Messages
131
Reaction score
186
First Language
English
Primarily Uses
RMMV
I have no clue why you'd need to use two states and a variable,
Because I was following your initial suggestions. Your initial post with the State X and Y notetags did not actually work for me, even though I used them exactly as you wrote them. The State Y continued to repeat the effect. So I tried adapting them with the variable idea that you yourself also suggested and found that it worked better then. I've already said all this in my previous posts.

Moving on, this works now and the states are finally working as intended. Later I may try revisiting these again to make a more efficient, single state. But for now, I am content ending this thread.

Thank you for your help and time.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
7,629
Reaction score
5,398
First Language
English
Primarily Uses
RMMV
Your initial post with the State X and Y notetags did not actually work for me, even though I used them exactly as you wrote them.
¯\_(ツ)_/¯ It works in my test project. Perhaps you have something else going on that's messing with some of it.

I'm glad you got it working the way you want. Peace out.
 

Latest Threads

Latest Posts

Latest Profile Posts

Made a title screen, and by ''made'' I ofc mean I slapped a simple title on some cool art I bought xD This side project might be fun.

sIMPLE.png
CDF.png

Trying for a Classical RPG with Pokemon Elements. Capture monsters like Zombies and Harpys and use them on your team.
ow28O4A.png

Astarte in her usual demeanor: mocking people.
45% off MZ on Steam. Just in case some are like me and never check for that stuff :)
I was surprised to see a email from Safeway that my grocery have been delivered when they have not. The email was a noreply message. So enjoy the $88 of free food random person.

Forum statistics

Threads
129,870
Messages
1,205,817
Members
171,042
Latest member
Hoplon
Top