Stacking Elemental Buff?

Hello there, I've pretty much exclusively made this account to post about this problem I've been having:

I'm trying to create a stacking status effect that gives a elemental damage buff to the caster depending on its stack (5% at 1 stack, 8% at 2 stacks, 12% at 3 stacks)

To do so I've been trying to use two plugins that I've seen reccomended for this purpose:

YEP_BuffStatesCore

&

YEP_ElementCore

This is the note code I've put in the status effect:


<Custom Apply Effect> target.addStateCounter(13, 1) if (target.getStateCounter(13) > 3){ target.setStateCounter(13, 3)} </Custom Apply Effect> <Custom Confirm Effect> if (self.getStateCounter(13) = 1) { <Element Amplify Fire: +5%> } </Custom Confirm Effect> <Custom Confirm Effect> if (self.getStateCounter(13) = 2) { <Element Amplify Fire: +8%> } </Custom Confirm Effect> <Custom Confirm Effect> if (self.getStateCounter(13) = 3) { <Element Amplify Fire: +12%> } </Custom Confirm Effect>

I'm an extreme noobie at JavaScript so forgive me if this looks like a blasphemy.

Anyway the effect is not at all what I want it to be - while the counter does appear in-game, and the buff does apply, they don't interact with each other, and it defaults to +12% regardless of status count.

Anyone know a way around this? Are they just completely incompatible plugins?
I have moved this thread to JavaScript/Plug-in Support.
You can't put notetags inside of notetags. You can only put JavaScript inside of Yanfly's Custom X notetags.

There's also no such thing as "self," I don't know where you got that. The instructions for the plugin show "user".

You need to create 4 different states - one blank, the other 3 have the increasing amounts of Amplify.

I'm going to call them states 1, 2, 3, 4, you put the correct IDs in for your database. The skill itself gives state 1, then that has the following notetag:
Code:
<Custom Apply Effect>
if (target.isStateAffected(4))
    return;
else if (target.isStateAffected(3))
{
    target.removeState(3);
    target.addState(4);
}
else if (target.isStateAffected(2))
{
    target.removeState(2);
    target.addState(3);
}
else
    target.addState(2);

target.removeState(1);

</Custom Apply Effect>
You can't put notetags inside of notetags. You can only put JavaScript inside of Yanfly's Custom X notetags.

There's also no such thing as "self," I don't know where you got that. The instructions for the plugin show "user".

You need to create 4 different states - one blank, the other 3 have the increasing amounts of Amplify.

I'm going to call them states 1, 2, 3, 4, you put the correct IDs in for your database. The skill itself gives state 1, then that has the following notetag:
Code:
<Custom Apply Effect>
if (target.isStateAffected(4))
    return;
else if (target.isStateAffected(3))
{
    target.removeState(3);
    target.addState(4);
}
else if (target.isStateAffected(2))
{
    target.removeState(2);
    target.addState(3);
}
else
    target.addState(2);

target.removeState(1);

</Custom Apply Effect>
Tried to do this, didn't work - did 4 different states, added this code to the invisible one, placed the correct IDs for them, but no effect was applied.

I should note that this needs to apply to the caster of the spell, which I manage to do using said formula:


a.addState(19); 100 + a.mat * 3 - b.mdf * 2

It worked before, but now it's not.
Please post screenshots of the skill, the states, and paste exactly what you have in the notetag.
The full code is


<Custom Apply Effect> if (target.isStateAffected(15)) return; else if (target.isStateAffected(14)) { target.removeState(14); target.addState(15); } else if (target.isStateAffected(13)) { target.removeState(13); target.addState(14); } else target.addState(13); target.removeState(19); </Custom Apply Effect>

Screenshot (3).png


Screenshot (6).png

Other states are the same, just higher amplify.

And here's the skill:

Screenshot (7).png



Also to avoid any doubt: Yes, I have the plugins installed and activated, they worked individually prior to this.
Your state 13 has an extra close brace floating after the notetag.

The state notetag isn't working because the target of the skill isn't the one receiving the state. Change all of the "target" to "user".
Changed all of that, buffs still don't apply at all.
Then you need to troubleshoot your plugins. Check the order of all Yanfly plugins matches the order they're listed in on the Yanfly Engine Web site.

Check that they're all the latest version, and your MV project is 1.6.1 or 1.6.2 (in the rpg_core.js file).

Are you starting a new game after making changes to notetags? Your database won't refresh if you're loading a save.
Again, both plugins (ElementCore and BuffStatesCore) were working. Unless your code requires some third plugin I don't have, then it's impossible for it to be a problem of plugins.

Yes, I am starting a new game after making changes.
If you press F12 and go to the Console tab, are there any errors?
Yep

Screenshot (8).png


Seems like the return statement is the problem
Ah, because eval expects a boolean value. That's fine, it doesn't matter anyway - just get rid of the first two lines, make the ifs start after that:
Code:
<Custom Apply Effect> 
if (user.isStateAffected(14)) 
{
    user.removeState(14);
    user.addState(15);
} 
else if (user.isStateAffected(13)) 
{
    user.removeState(13);
    user.addState(14); 
} 
else
    user.addState(13); 
target.removeState(19); 
</Custom Apply Effect>

and give state 15 a Trait for State Resist on state 19.
It works! However, this does create an unintended problem: after reaching three, the skill can no longer refresh the duration of the buff.
You didn't say it should 😛

So change it once more...
Code:
<Custom Apply Effect> 
if (user.isStateAffected(15))
    user.setStateTurns(15, X);

else if (user.isStateAffected(14)) 
{
    user.removeState(14);
    user.addState(15);
} 

else if (user.isStateAffected(13)) 
{
    user.removeState(13);
    user.addState(14); 
} 

else
    user.addState(13); 

target.removeState(19); 
</Custom Apply Effect>
where X is the number of turns you want to bump it up to. And take the state resist off of 15.
Works like a charm, thank you!

Original thread: https://forums.rpgmakerweb.com/threads/stacking-elemental-buff.159509/