# How to create stacking buffs/debuffs similar to Pokemon?

#### Mahoken

##### Veteran
I want to be able to make stacking buffs/defbuffs that go by Pokemon's rule. In Pokemon, you can increase or decrease a specific stat up to 6 times (stages).

Something like:

+1 = 150% stat

+2 = 200% stat

+3 = 250% stat

or

-1 = 66% stat

-2 = 50% stat

-3 = 40% stat

I'm not sure how I could make this, so any help would be appreciated! Maybe there's a script out there that I don't know of.

#### boomy

##### Veteran
Yanfly's buffs and states core allows you to change how many times a buff or debuff can stack
In the plugin settings there is are a few options for stacking buffs (Buff settings):

Default Limit: 6

Maximum Limit: 6

Buff Formula: Blah

Normally, MV allows buffs to stack twice. In pokemon, as you have stated, buffs can be stacked up 6 times.
Your main issue is formula. The buff formula in Yanfly's plugin (default formula) is: No. of stacks x factor + 1

This formula doesn't work well with Pokemon which uses:
(No. of stacks + 2) / 2 for buffs and
2 / (No. of stacks + 2) for debuffs

At the moment, the only way I can think of to incorporate this formula will be:

if (this._buffs[paramId] > 0) { (this._buffs[paramId] + 2) / 2 } else { (2 / (this._buffs[paramId] + 2) }

Note that the formulas are different depending if it's a debuff or a buff.
Also, evasion and accuracy cannot be modified in this way (you will have to use a state or something along those lines)

### Latest Profile Posts

To cut down on map lag, I've been researching how to implement a lighting layer as a single map overlay instead of a bunch of individual lights. Hopefully I'll have a screenshot soon!
Imagine having a game broken up into a whole bunch of chapters? Like Chapter 11 should be about the party members going bankrupt.
Over 1/4th of the calendars are already out Have you already put something to a good use?
Where would you go if you're looking to hire someone on here? I'm in need of a writer to take my story concept and turn it into npcs/dialog in my game.