MV Yanfly Buff and States Core - State removal condition

Hello!

Would someone be able to help me create a state using Yanflys Buffs and States Core?

What I'm hoping to create is a state that will last X round at least,after that,it will be removed with a specific probability.Or is it possible to have another plugin to achieve this effect?

Thank you!
Code:
<Custom Apply Effect>
user.turnsApplied=0;
</Custom Apply Effect>

<Custom Turn End Effect>
if (++user.turnsApplied>5 && Math.randomInt(100)<=40)
    user.removeState(stateId);
</Custom Turn End Effect>

<Custom Remove Effect>
delete user.turnsApplied;
</Custom Remove Effect>

Change the 5 to be however many guaranteed turns you want, and change the 40 to be the percentage chance of the state getting removed.
[代码]<自定义应用效果>
user.turnsApplied=0;
</自定义应用效果>

<自定义回合结束效果>
if (++user.turnsApplied>5 && Math.randomInt(100)<=40)
user.removeState(stateId);
</自定义转弯结束效果>

<自定义删除效果>
删除 user.turnsApplied;
</自定义删除效果>[/CODE]

将 5 更改为您想要的保证回合数,并将 40 更改为状态被移除的百分比机会。
Thank you very much for help! I will try it!

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-buff-and-states-core-state-removal-condition.159022/