Make States that Resist to certain Buff

Hello.

This is my first post in this Forum.

I'm currently working on a project in RPG Maker MV and I'm trying to implement a system where certain states can resist specific buffs.

I want to create states for my characters or enemies that provide resistance to certain buffs. For example, This state will resist the "Attack Up" buff, making it can't apply that buff to a character or enemy under this state.


Here's the picture of the state:
Screenshot 2024-05-13 211934.png


If anyone has experience implementing a similar system or has suggestions on how to achieve this, I would greatly appreciate your input. Whether it's through scripting, eventing, or a combination of both, any advice or examples would be incredibly helpful.

For Your Information: I Installed Yanfly BuffStatesCore plugin.
Try this:

Code:
<Custom Apply Effect>
target.removeState(158);
if (target._buffs[2] > 0){
 target.removeBuff(2);
 }
</Custom Apply Effect>

<Custom Deselect Effect>
if (target._buffs[2] > 0){
 target.removeBuff(2);
 }
</Custom Deselect Effect>
Try this:

Code:
<Custom Apply Effect>
target.removeState(158);
if (target._buffs[2] > 0){
 target.removeBuff(2);
 }
</Custom Apply Effect>

<Custom Deselect Effect>
if (target._buffs[2] > 0){
 target.removeBuff(2);
 }
</Custom Deselect Effect>

Thank you for the reply, it works very perfectly!
Have you tried adding the state Resist to 0% for that specific state?
Without making a plugin to add in a buff resistance stat similar to debuff resistance or changing how addBuff() works, i would suggest reserving a state and using its rate to be your buff rate. then in all of your skills and states that add buffs, youd add a random roll that checks against that state rate to determine if the buff sticks

so if state 100 was my buff rate "stat-state", id have my version of your state 159 reduce the rate for state 100 to 0, and then in every skill that adds buffs, instead of using the editors' addbuff effect id work in whatever variant of
Code:
if (Math.random() < target.stateRate(100)) target.addBuff(2, 5));
is needed into skill core/action sequence notetags
Thank you for the reply, it works very perfectly!
Happy to help! Your question gave me some inspiration for my game as well, so I'd call this a win-win scenario!

Welcome to the forums, btw 🙂

Original thread: https://forums.rpgmakerweb.com/threads/make-states-that-resist-to-certain-buff.168638/