MV State Restriction Bypass

So for once, I've decided to take one of my existing plugins and change it in a way to be more flexible instead of having it be a growing list of explicitly written exceptions that could only ever be used in my main project.

The idea is this:
It allows for states with restrictions to be given conditions for their restriction to be ignored while keeping the state active. The prompt comes from the passives and effects of a few of the bosses/actors in my main project. Examples:
- allowing a passive to enable retaining the ability to act after being put to sleep, while keeping the benefits/penalties of sleeping instead of resisting the state
- Requiring being affected by at least 2 separate "Cannot Move" states in total to become unable to move
- Adding an HP% threshold to a state to determine if it should render a battler unable to move
- Preventing statuses like confusion/berserk from removing control of an actor while benefitting from their parameter increases

Use the following as a guide to set up the conditions. It goes within the state's notebox.
Code:
<Restriction Bypass Condition>
bypass = some js condition goes here;
</Restriction Bypass Condition>
The value of the "bypass" variable determines if the state's restriction is considered. It defaults to being false and the restriction is ignored when its true.
Convenience variables include "user"/"target" for the battler the state is on, "stateId" for the current state's id, and "s"/"v" for the switch/variable data arrays

It works in my project with all the plugins I use as well as in a clean one. I'd imagine its fine for most setups. If anyone is interested in it, let me know if it causes any issues or oddities. Ive tested it for a bit within my "standard usage", but im sure someone else may be able to get it to set their game on fire.

actual plugin description comes soon:tm:
would you give the example of sleep while true and act?

like sleep state => cannot attack when hp < 50%

as it can be used as stand alone as well? or does it require YEP_BuffStateCore?
would you give the example of sleep while true and act?

like sleep state => cannot attack when hp < 50%
yeah, sure. you give the sleep state the "cannot move" restriction as you normally would, and then you give it the following tag
Code:
<Restriction Bypass Condition>
bypass = user.hpRate() > .5;
</Restriction Bypass Condition>
so long as the battler has more than 50% of their hp, theyll remain able to act while the state is still on them. once they go below 50%, theyll become unable to move like normal

as it can be used as stand alone as well? or does it require YEP_BuffStateCore?
It works both by itself and with the yanfly buffs and states plugin. i dont imagine there'd be many plugins that would outright make it fail as it does a specific thing i havent seen other plugins do, but i cant rule out odd interactions here and there
so
bypass = user.isStateAffect(x) && !user.isStateAffected(y)

would work too, but stops if both is true if vice versa and both active?
as this would be pretty awesome to have some cool affects.

I save the snippet for later when dealing with battle part, as if I get ABS to work,
I hope this bit also works as it's kind of awesome for more possibilities than
default.

it might be doable with yanfly, but this is actually way cleaner as well 🙂
so I might have use for it, so I think of some ways to put it in good use ^^
so
bypass = user.isStateAffected(x) && !user.isStateAffected(y)

would work too, but stops if both is true if vice versa and both active?
itll allow the battler to ignore the current state's restriction only if they have state x on while they also do not have state y

it might be doable with yanfly, but this is actually way cleaner as well
It is doable with yanfly plugins, but it becomes tedious depending on what it is to only do it with their plugins.

All 4 examples i gave in the first post are some of the cases from within my project i actively use it for. The first one is the first one that came up. Its a plot point that one character is capable of retaining their consciousness while asleep. I wanted that to be relevant in gameplay too, so it became one of her toggleable passives.

what i initially did was make it so that every source of sleep would apply a lookalike without the restriction to any battler with the passive. it worked, but its something i had to always keep in mind and every effect I had that did something extra to sleeping targets became required to also check for the alternate sleep state as well.

that led to me just explicitly writing the exception into the restriction function that if a battler has that passive, is asleep, and only has one state active with a restriction of 4, that it should ignore it. it worked just fine, but as i collected different exceptions to states, that function got larger to the point that i figured it would be better to make notetags out of it.
halfway through, i realized that i could make it more like one of yanfly's plugins, share it as it was, and add on to it later
thanks for the nice explanation though for a nice insight.

I saw it has no helpfile as it speaks for itself, but still, it could be nice
to have one as reference there + the simple example to give out
Code:
<Restriction Bypass Condition>
    bypass = user.hpRate() > .5;
</Restriction Bypass Condition>

// or another example

<Restriction Bypass Condition>
    bypass = user.isStateAffected(x) && !user.isStateAffected(y)
</Restriction Bypass Condition>

so combination can work for them as well, and the variables
with a, user, target, s, v for the likes.

so if you update with a helpfile or bugfix/correction, place it within it.

thank you again for this awesome plugin 🙂
I saw it has no helpfile as it speaks for itself, but still, it could be nice
to have one as reference there + the simple example to give out
Code:
yeah, i did say
actual plugin description comes soon:tm:
in the first post. got a little lazy, chose to write it at a later time, and just describe it here. i could just copypaste my first post into it for now...

Original thread: https://forums.rpgmakerweb.com/threads/state-restriction-bypass.172375/