[MV][Help] Increase/Decrease Stats Based on Stacked States

Yo. First post and I really didn't want a help thread to be it but I'm working on my own game and I have failed to get an answer from searching the forums. orz

Anyway, I would like to assign states to increase/decrease parameters by certain amounts, then increasing those amounts by the number of stacks of the respective state. My roadblock is as follows:
  • MV has a buff/debuff effect for Skills, but the rate is flat and can't be adjusted for different skills.
  • I can assign states to buff/debuff the stats I wish, but they can't stack. I think there is a way with YEP to accomplish this, but I can't figure it out.
To recap, I want to accomplish a system where states can be stacked, and the buff/debuff amount increases per stack. I have all of the YEP library paid but if I need more, let me know.

Thanks in advance~
You can do this with one of the YEP plugins you have access to:
If you watch the video it breaks it down in-depth on how to use it, in addition to the help section on the linked page. If you have any questions from there let me know.
I watched the vid and it doesn't exactly answer my question. What I got was extending the duration of buffs and states. What I need is to have stackable "states" so if a state is applied again to a battler, the potency of the state is increased.

I've moved this thread to Plug-in Requests. Thank you.



This will probably require a plug-in which allows you to stack states, as the buffs are meant to be hard coded for the entire game how much you increase/decrease them by.
I watched the vid and it doesn't exactly answer my question. What I got was extending the duration of buffs and states. What I need is to have stackable "states" so if a state is applied again to a battler, the potency of the state is increased.

It requires use of the lunatic code, but the answer is described here by @ramza:
here is the full solution to your issue.


Buffs and States core has a build in 'counter' function, which can be used to add stacks to a state. In using this, you only need one state, not (up to) 10, and reapplying the state will increase the counter of that state automatically. You can then use a custom turn end effect to deal damage directly to affected battlers, using the number of stacks the state has as the base for the damage dealt.


<Custom Apply Effect>
target.addStateCounter(38, 1); //38 is the number of the state
if (target.getStateCounter(38) > 10){
target.setStateCounter(38, 10)}
</Custom Apply Effect>
<Custom Turn End Effect>
var rnd = 20 //the variance of the damage you want to deal
var formula = Math.round(15 * this.getStateCounter(38)); // this state will do 15 damage per stack. modify as you see fit
var total = Math.floor(formula * ((Math.random()*(rnd * 2)+(100-rnd))/100) // this should make the effect deal damage with 20% variance
this.gainHp(-total);
this.startDamagePopup();
if (this.isDead())
{
this.performCollapse();
}
</Custom Turn End Effect>
<Custom Leave Effect>
//this is so that the effect deals damage on the last turn it is active
var rnd = 20
var formula = Math.round(15 * this.getStateCounter(38));
var total = Math.floor(formula * ((Math.random()*(rnd * 2)+(100-rnd))/100)
this.gainHp(-total);
this.startDamagePopup();
if (this.isDead())
{
this.performCollapse();
}
</Custom Leave Effect>


I hope this helps you.

If that doesn't work there are some scripts below, but I am unsure if they work with MV.

You can do this with a common event system as well but it will be very messy.
Actually, this is what I thought about when I saw YEP having stackable states (I have limited JS knowledge, and this wasn't exactly detailed in the Yanfly wiki)! For this, I thank you.

I now run in another problem, though. The link you provided describes how to apply Poison. I'd like to use the stacking states to adjust parameters (MaxHP, MaxMP, ATK, etc.) and maybe EX and SP Parameters. Is there something extra that I need to accomplish to achieve this?
Currently working on trying to solve this by using Yanfly's Base Parameter Control, using the state notetag
<stat Rate: x%>

If I could just get it to accept a variable as x, it could be tied to the state counter.

EDIT: Well, I got it to accept functions by writing a patch. Problem is, I can't start the game because said functions aren't defined. Including game variables.
I'm gonna consider this a dead end right now and try another approach.

EDIT2: Alright, I managed to find a different solution. Use this:
Together with YEP Buffs and States Core you can do something like this:

<params>
MHP: ((current * 0.01) * a.getStateCounter(StateId))
</params>

The above notetag will increase Max HP by 1% per state counter. Put a - before it to decrease instead.
Oh wow. I had already given up on this thread, but I thank you for reigniting my hope.

So far, I'm trying to use this and got this error:

quasijserror.png

If anyone's curious on what I did, this is the tags that I used on a MDEF Down state:

Code:
<Custom Apply Effect>
target._stackingmDefDown = target._stackingmDefDown || 0;
target._stackingmDefDown += 1;
</Custom Apply Effect>

<Custom Remove Effect>
target._stackingmDefDown = 0;
</Custom Remove Effect>

<params>
MHP: ((current * 0.01) * a.stackingmDefDown(MDF))
</params>

While this run ended in failure, I won't be deterred right now, and will post if I find anything else.

EDIT: Elaborated a few things.

EDIT2: Yes, I had the state adjust MHP for that test run, and would move it to MDF later.

I made a few adjustments to the code and am now following these tags:

Code:
<Custom Apply Effect>
target._stackingmDefDown = target._stackingmDefDown || 0;
target._stackingmDefDown += 1;
</Custom Apply Effect>

<Custom Remove Effect>
target._stackingmDefDown = 0;
</Custom Remove Effect>

<params>
MDF: ((current * 0.01) * target._stackingmDefDown(MDF))
</params>

This time, I have received a different error, shown below:
quasijserror2.png

EDIT3: So after looking at the thread from Quasi, I tried a few different things. I am now running these tags:

Code:
<Custom Apply Effect>
target._stackingmDefDown = target._stackingmDefDown || 0;
target._stackingmDefDown += 1;
</Custom Apply Effect>

<Custom Remove Effect>
target._stackingmDefDown = 0;
</Custom Remove Effect>

<params>MDF: a.mdf * (0.1 * target._stackingmDefDown(MDF))</params>

This time, I encountered a new error:
quasijserror3.png
The thing about that last error is that you're using a multiple of MDF to modify MDF, which causes an infinite loop. This is why "current" was implemented.
Anyway, the functions you're using are quite different from mine.

This is how I successfully applied scaling to a state:
Code:
<Custom Apply Effect>
user.addStateCounter(x, 1)
</Custom Apply Effect>

<Custom Turn Start Effect>
user.addStateCounter(x, 1)
</Custom Turn Start Effect>

<params>
MHP: ((current * 0.01) * a.getStateCounter(x))
</params>
Where x is the number of the state in the editor, and 1 is the amount of counters added.
The amount of counters is automatically reset if the state is removed, with no command needed.

The script calls for the YEP effects are at the bottom of the Buffs and States Core description.
I must thank you in advance for going through this with me. I'm almost tempted to drop this idea in favor of a different way to apply debuffs.

Anyway, I added your tags as-is on my state, but this time got the following error:

quasijserror4.png

I'm not sure how to define x here...
You have to replace x with the number of the state.
So if the state you're writing in is 20th in the database, replace x with 20.
Oh, thanks. I didn't think about that. orz

Yeah, it no longer crashes! Although the formula you gave me seems to buff the target than debuff it. No worries, as I'll figure that part out myself.

I must ask though: Is there a copy of Quasi's plugin's ToS? The one from the thread earlier seems to no longer work.

Once more, thanks~
Yeah just put a minus sign at the start of the formula.

Another user did post the ToS in that thread, on the last page. They're very permissive.
Awesome. I guess I'm all set then. Thanks so much.
No problem, I just happened to be looking for a way to do the same thing.

Original thread: https://forums.rpgmakerweb.com/threads/mv-help-increase-decrease-stats-based-on-stacked-states.120310/