[RMMV] Elemental state not correctly working

Hello !

I'm using these plugins :
YEP Element Core
YEP attachable augments

I'm doing a system of Attachable augments giving additional stats, states, or other bonuses.
My characters have 2 accessory slots.
When I have an Augment on both accessories, the additional state applies only once instead of twice.

Here is what I've done :

- Item notes
1584093823697.png


- State notes
1584093873544.png


This augment amplifies my water damage by 5%
Let's admit my water damages deal 100HP flat, with 1 augment it will deal 105HP (100 + (100*5%)) damages
But when I equip 2 accessories with each this augment, it still does 105HP damages instead of 100 + (100*5%) + (100*5%)


How can I make it work ?

I'll take every suggestions.
Thanks, see you later
do you also have AutoPassiveStates installed to ablet oadd passive state?
if not, install it. if it still doesn't work, check if your plugins are in the correct order and up to date.
I have it, in the good order and up to date.

The thing is, my passive state is added, but only once instead of twice (when the augment is equipped twice).
And the Augment is a common item, so the passive state can't be added on it.

EDIT : I think it doesn't apply it a second time because both augments are applying the same effect.
I think I need a condition saying
If this state is applied and if you want to apply it a second time, then apply this state *2 (or something like this)
by default, no state can be added more than once. If a state already is available, applying it again only resets the timer (if any).

I know there are plugins that change the engine to allow stackable states, but those have to be implemented and configured before this idea can work.
The main issue right now is that the passive state can only apply once. Adding the passive state a second time, by default, doesn't cause it to stack. So technically, the passive state is working as intended, it just isn't working the way you want it to.

Some custom code may be needed to fix this problem. Try something like this in the state notetag instead of Amplify:

<Custom Apply Effect>
user._waterAmp = user._waterAmp || 0;
user._waterAmp += 1;
</Custom Apply Effect>

<Custom Remove Effect>
user._waterAmp -= 1;
if (user._waterAmp === 0) user._waterAmp = undefined;
</Custom Remove Effect>

<Custom Confirm Effect>
user._waterAmp = user._waterAmp || 1;
var elements = this.getItemElements();
if (elements.contains(waterId#)) {
var increase = user._waterAmp;
value = Math.floor(1 + (.05 * increase));
}
</Custom Confirm Effect>

I'm not certain if this will work with passive states, but it's worth a shot.

Edit: Also, you'll need Buffs & States Core for this to work.
by default, no state can be added more than once. If a state already is available, applying it again only resets the timer (if any).

I know there are plugins that change the engine to allow stackable states, but those have to be implemented and configured before this idea can work.

Yes, that's what I was thinking


The main issue right now is that the passive state can only apply once. Adding the passive state a second time, by default, doesn't cause it to stack. So technically, the passive state is working as intended, it just isn't working the way you want it to.

Some custom code may be needed to fix this problem. Try something like this in the state notetag instead of Amplify:

<Custom Apply Effect>
user._waterAmp = user._waterAmp || 0;
user._waterAmp += 1;
</Custom Apply Effect>

<Custom Remove Effect>
user._waterAmp -= 1;
if (user._waterAmp === 0) user._waterAmp = undefined;
</Custom Remove Effect>

<Custom Confirm Effect>
user._waterAmp = user._waterAmp || 1;
var elements = this.getItemElements();
if (elements.contains(waterId#)) {
var increase = user._waterAmp;
value = Math.floor(1 + (.05 * increase));
}
</Custom Confirm Effect>

I'm not certain if this will work with passive states, but it's worth a shot.

Edit: Also, you'll need Buffs & States Core for this to work.

I see.
I tested it but it's only doing 1HP dmg, maybe I missed something in your code and I had to replace something by something else (instead of waterId# I wrote 5 which is my water element ID)
OK, I see the issue. I put in the wrong equation near the end. This line:

value = Math.floor(1 + (.05 * increase));

Should be this:

value *= 1 + (.05 * increase);
Works almost like i'd like

weather or not I have 1 or 2 accessories with the augment equipped, it deal 120HP dmg
when the damage is applied, the damage pop up writes 115 5
I may have given the wrong value again. The current version may be keeping decimals. Try this one:

value = Math.floor(value * (1 + .05 * increase));
works when 1 augment is equipped and writing the pop up damage correctly

doesn't work when 2 augments are equipped. It deals the exact same damage as when 1 augment is equipped.
I was afraid that might happen. Once the passive is attached once, it won't apply the state a second time. The code needs to be changed in a way that changes the waterAmp variable through something other than the state. Unfortunately, I'm not sure if the augment item can support code that affects the actor, so I'm a bit lost at this point.
As I wrote far above there should be plugins that allow for stacking states, you need to find one of them and install that one
Thanks to both of you for the help.

I'm gonna check for that kind of plugin.

Original thread: https://forums.rpgmakerweb.com/threads/rmmv-elemental-state-not-correctly-working.119079/