MV Yanfly Absorption Barrier as a State

Hello!

I was trying to use it as a state that is called via a self buff skill. The state icon appears after using the skill, but the effect does not work(no barrier).

So I tried using it as a skill(adding a specific amount of barrier each skill use). It does work, BUT I want it to last only after the turn it was used: so, if in turn1 I use the skill, ended my turn, enemy uses their turn and my barrier was not broken, in my turn2, I want it to be automatically be removed.

Now I know you can specify how long the barrier lasts, the problem is that the skill I attaching it to can be used multiple times in 1 turn, so the expiration stacks on top of each other: so if I use the skill twice in 1 turn, instead of it expiring after 1 turn, it doesn’t because I used it twice, the expiry is now 2 turns.

Is there a solution to this?
Hello!

I was trying to use it as a state that is called via a self buff skill. The state icon appears after using the skill, but the effect does not work(no barrier).
Correct. If you look at the instructions for the plugin, the notetags to give barrier points are for Skills and Items, they don't work in states.

So you either put it as a notetag in the skill or use the JavaScript calls in conjunction with Buffs & States notetags.

So I tried using it as a skill(adding a specific amount of barrier each skill use). It does work, BUT I want it to last only after the turn it was used
Give the appropriate timing to your state. Reference the bottom of the Barrier Points instructions and give your state the notetag from Buffs & States Core:
Code:
<Custom Leave Effect>
user.loseBarrier(user.barrierPoints());
</Custom Leave Effect>

so if I use the skill twice in 1 turn, instead of it expiring after 1 turn, it doesn’t because I used it twice, the expiry is now 2 turns.
Give the state this notetag:
Code:
<Custom Apply Effect>
if (user.isStateAffected(stateId))
    user._stateTurns[stateId]++;
</Custom Apply Effect>

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-absorption-barrier-as-a-state.156038/