How to make Buff Duration depend on stats?

Hello everyone, i need a tip.

As default, by skills we can add a buff or debuff with X turns duration. I wanted to set this X dependable on caster's stat (MAT for example). Noticed i can do this via YEP_BuffsStatesCore. There what typed in notes:

<Custom Def Buff Turn>
turn = 1;
turn += user.mat / 25;
</Custom Def Buff Turn>

But in fact, skill adds nothing. What to do? Thanks for advance!
You should not use CAPITAL LETTERS for "stat". And better keep its turn as an integer by using Math.floor or Math.round or Math.ceil (I prefer round).
Code:
<Custom def Buff Turn>
turn = 1 + Math.round(user.mat / 25);
</Custom def Buff Turn>
Moved to: JavaScript/Plugin Support
You should not use CAPITAL LETTERS for "stat". And better keep its turn as an integer by using Math.floor or Math.round or Math.ceil (I prefer round).
Code:
<Custom def Buff Turn>
turn = 1 + Math.round(user.mat / 25);
</Custom def Buff Turn>
Doesn't work either
Any number below 25 will result in zero, thus it will add nothing.

Are you sure you are testing this with an Actor that has mat higher than 25?
Any number below 25 will result in zero, thus it will add nothing.

Are you sure you are testing this with an Actor that has mat higher than 25?
Sure. I was testing with high leveled actor with above than 100 mat. Even reduced division by 5, but still got nothing.

Maybe a problem lies deeper.
Consider this as bump, but I want to figure it out.
What exactly I need (plugins, codes) to make it?
Why not start this over.

But in fact, skill adds nothing. What to do? Thanks for advance!

What exactly did you mean by this?
That the buff stayed at the preset number of turns or that it was never added at all?

If the turns didn't change, consider changimg your formula for testing purposes.

<Custom Def Buff Turn>
turn = 1;
turn += 99
</Custom Def Buff Turn>

And see if that gives 100 turns to the buff.
If it doesnt add the buff at all, there is probably a syntax error somewhere in the formula.
A link to the plugin would help me verify this.
If it doesnt add the buff at all, there is probably a syntax error somewhere in the formula.
A link to the plugin would help me verify this.
Maybe syntax error.
Plugin taken from official site, latest version and not modified - http://yanfly.moe/2015/12/25/yep-50-buffs-states-core/
I will also give that skill responsible for buffing and current plugin list

Снимок экрана (39).png Снимок экрана (40).png Снимок экрана (41).png Снимок экрана (42).png Снимок экрана (43).png
Ok. I'll have to look in more detail once I can get to my comp but for now the syntax seem ok. Next test then is to simply give the buff a number and see if it works.
Try:

<Custom Def Buff Turn>
turn = 100;
</Custom Def Buff Turn>

And see if you do indeed get a def buff of 100 turns.
Ok. I'll have to look in more detail once I can get to my comp but for now the syntax seem ok. Next test then is to simply give the buff a number and see if it works.
Try:

<Custom Def Buff Turn>
turn = 100;
</Custom Def Buff Turn>

And see if you do indeed get a def buff of 100 turns.
Does't work...
Tested even in an empty new project, with BattleEngineCore and BuffsStatesCore
Did you copy/paste what I suggested?
It looks like the stat has to be lower case to work.

So try it again with this one:

<Custom def Buff Turn>
turn = 100;
</Custom def Buff Turn>

and see.
And remember also that this one is for a defence buff so alter your skill to give that buff.
Did you copy/paste what I suggested?
It looks like the stat has to be lower case to work.

So try it again with this one:

<Custom def Buff Turn>
turn = 100;
</Custom def Buff Turn>

and see.
And remember also that this one is for a defence buff so alter your skill to give that buff.
Yes I did. Several times
Ok. I'll play around with it when I get time.

EDIT: And by the way, I'm not sure, but I think you need to have the skill actually add the buff via traits before the plugin can change the turns.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-buff-duration-depend-on-stats.107076/