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

MarxMayhem

Veteran
Veteran
Joined
Apr 17, 2020
Messages
31
Reaction score
14
First Language
Filipino
Primarily Uses
RMMV
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~
 

MarxMayhem

Veteran
Veteran
Joined
Apr 17, 2020
Messages
31
Reaction score
14
First Language
Filipino
Primarily Uses
RMMV
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.
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,789
Reaction score
14,587
First Language
English
Primarily Uses
RMVXA

I've moved this thread to Plug-in Requests. Please be sure to post your threads in the correct forum next time. 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.
 

Chroma-Creative-Solutions

Graphic Designer
Veteran
Joined
Apr 5, 2020
Messages
65
Reaction score
24
First Language
English
Primarily Uses
RMMV
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.
 

MarxMayhem

Veteran
Veteran
Joined
Apr 17, 2020
Messages
31
Reaction score
14
First Language
Filipino
Primarily Uses
RMMV
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?
 

Msoulwing

Villager
Member
Joined
Jun 1, 2018
Messages
13
Reaction score
4
First Language
English
Primarily Uses
RMMV
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.
 
Last edited:

MarxMayhem

Veteran
Veteran
Joined
Apr 17, 2020
Messages
31
Reaction score
14
First Language
Filipino
Primarily Uses
RMMV
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
 
Last edited:

Msoulwing

Villager
Member
Joined
Jun 1, 2018
Messages
13
Reaction score
4
First Language
English
Primarily Uses
RMMV
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.
 

MarxMayhem

Veteran
Veteran
Joined
Apr 17, 2020
Messages
31
Reaction score
14
First Language
Filipino
Primarily Uses
RMMV
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...
 

Msoulwing

Villager
Member
Joined
Jun 1, 2018
Messages
13
Reaction score
4
First Language
English
Primarily Uses
RMMV
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.
 

MarxMayhem

Veteran
Veteran
Joined
Apr 17, 2020
Messages
31
Reaction score
14
First Language
Filipino
Primarily Uses
RMMV
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~
 

Msoulwing

Villager
Member
Joined
Jun 1, 2018
Messages
13
Reaction score
4
First Language
English
Primarily Uses
RMMV
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.
 

MarxMayhem

Veteran
Veteran
Joined
Apr 17, 2020
Messages
31
Reaction score
14
First Language
Filipino
Primarily Uses
RMMV
Awesome. I guess I'm all set then. Thanks so much.
 

Msoulwing

Villager
Member
Joined
Jun 1, 2018
Messages
13
Reaction score
4
First Language
English
Primarily Uses
RMMV
No problem, I just happened to be looking for a way to do the same thing.
 

Latest Threads

Latest Posts

Latest Profile Posts

Sorry, lot of unexpected hospital things. I'm trying. Life is hectic atm. I know it must seem like I say this every week. XD Anybody wanna trade me for awhile so I can game test and game make?
I love running events, I hate setting up all the awards at the end. >_> But you know, gotta do it :B :B :B

Forum statistics

Threads
111,241
Messages
1,059,514
Members
144,506
Latest member
ItsFNREtro
Top