[SOLVED]Modifying state durations with Yanfly Buff/State core

Hey y'all!

So Yanfly's Buff/State core allows me to create buffs/states that can have their durations increased by skills and items easily enough. But what I want to do is make a state that has its duration increased by luck (or a stat, you know).

There's some "lunatic" JS stuff the plugin has that hopefully will make this possible. The formula itself should be pretty easy because it's just going to be 1:1 (don't worry, luck ranges from 0 to 5 in my game). So it would just be luck - 1 since RPG maker doesn't let me make states with a 0 turn duration, and I want it to literally be one turn per luck.
If you use yanfly's buffs and states core there's actually a built in function for that:

Code:
user.setStateTurns(stateId,turns)

That's what I used in Eternal conflict to make the charisma bonus work, and you can see an example of it in the states notebox if you have access still.
There's also a setBuffTurns functions if you ever need it.

Setting state 12 to turns 4 + luck automatically would be as easy as:
Code:
<Custom Apply Effect>
user.setStateTurns(12, 4 + user.luk)
</Custom Apply Effect>
Oh, hey, dude! Good to see ya!

Looks like that works (aside from the superfluous parentheses :hswt:), thanks!

How you doing, anyway? Hope you're doing well!
Ah well, modified it too quickly and missed that. Glad you've got it working.

As for me, everything is fine.

I hope you're doing well too!
Good luck on your project, I'll keep an eye on it.

Original thread: https://forums.rpgmakerweb.com/threads/solved-modifying-state-durations-with-yanfly-buff-state-core.110242/