(Solved) (Yanfly Plugins) Trying to alter Stockpile tips and tricks.

So recently Yanfly came out with a tips and tricks for a Stockpile effect. You can stock up stacks to be consumed with abilities.

Yanfly Stockpile
http://yanfly.moe/2017/02/15/tips-tricks-stockpile-pokemon-rpg-maker-mv/#more-4848

Yanfly Consume Stacks
http://yanfly.moe/2017/02/17/tips-tricks-stockpile-spit-up-pokemon-rpg-maker-mv/#more-4855

I'm trying to build a state that adds a charge each turn, and then a skill that will consume all stacks and have a different effect based on stacks consumed.
My passive state doesn't seem to want to build up stacks.
Passive State - Temporal Anomaly:
<Custom Turn Start Effect>
// Default the temporal stacks to 0.
user._temporal = user._temporal || 0;
// Increase the temporal stack by 1
user._temporal += 1;
// Cap the temporal stack at 9
user._temporal = Math.min(user._temporal, 9);
// Update the state counter for the temporal stack
user.setStateCounter(stateId, user._temporal);
</Custom Turn Start Effect>

I haven't exactly built the skill yet because I haven't been able to get the state working.
Skill - Time Freeze:
<Custom Execution>
// If the temporal stack is 1-3
if (user._temporal === 1) { - I have no idea what to change the "=== 1" to.
user.addState(915);
// If the temporal stack is 4-6
} else if (user._temporal === 4) { - I have no idea what to change the "=== 4" to.
user.addState(916);
// If the temporal stack is 7-9
} else {
user.addState(917);
}
</Custom Execution>

<After Eval>
// Reduce stacks back to 1.
(No idea what to put here)
</After Eval>

I barely grasp how to use Javascript, so any help would be appreciated.
// If the temporal stack is 1-3
if (user._temporal === 1) { - I have no idea what to change the "=== 1" to.
user.addState(915);

if (user._temporal > 0 && user._temporal < 4) //checks if temporal count is greater than 0 AND less than 4 (1-3)
You can use the syntax here to figure out the others.
Side note: You have over 900 states?!

<After Eval>
// Reduce stacks back to 1.
(No idea what to put here)
</After Eval>

user._temporal = 0 //removes all temporal stocks
Thank you very much! But do you have any idea why the passive state won't gain stacks? In a bit I'm going to try to build it differently just in case a passive state can't gain stacks. I'll build it so the passive state adds a new state at the beginning of a turn (if it doesn't exist), and the new state will be the temporal stacking. Hopefully that'll work.

And I have a little over 700 states, but there's some spacing between some states for headers and such. I have a section of status ailments, class states, passive states (equippable like FF Tactics), gear states, and misc states.

*edit* So the state itself still isn't working. This is what I have for the modified state:

Passive State - Tempest of Time (This state works fine):
<Custom Turn Start Effect>
if (!a.isStateAffected(331)) {
if (target.isAlive()) {
user.addState(331);
}
}
</Custom Turn Start Effect>

State 331 - Temporal (This state does not work):
<Custom Turn Start Effect>
user._temporal = user._temporal || 0;
user._temporal += 1;
user._temporal = Math.min(user._temporal, 10);
user.setStateCounter(stateId, user._temporal);
</Custom Turn Start Effect>

State 331 doesn't seem to add any stacks or even display the counter for that matter.
Make Temporal a custom apply effect instead
I was just teasing about the number of states.
While it does seem like a lot to me (I currently have less than 80 that I use), if it works for you, no problem.

But back on topic, I'm curious as to how you know the state isn't working if you didn't make a skill that uses it.
What part isn't working and besides the counter thing, how do you know?
(I should mention that I don't use any passive state plugins and there don't know what the setStateCounter call does.
I AM a plugin maker here and can figure out most code I see with some time, but unless you show me what your states are supposed to do, I can't really show you why it's not doing it.)
@Maliki79 I hadn't tested it with the skill, but the counter wasn't showing up at all. Displaying the counter would be very important to the class that uses it. I did, however, have a talk with a friend of mine, @Nekoyoubi, using a plugin of his that uses states as resources (Rage, Energy, etc.). I've used this plugin for a long time, but until now I hadn't thought about using it in quite this way.
http://stitchgaming.com/2016/04/nemv-state-resources/

The solution we came up with was this:
Passive State 330 - Tempest of Time. This state is tied to the Arbiter soul and applies state 331 during battle.
<Custom Battle Effect>
if (!a.isStateAffected(331)) {
if (target.isAlive()) {
user.addState(331);
}
}
</Custom Battle Effect>
<Custom Turn Start Effect>
if (!a.isStateAffected(331)) {
if (target.isAlive()) {
user.addState(331);
}
}
</Custom Turn Start Effect>

State 331 - Temporal. This state is a resource (similar to Yanfly's stacking) that can be used to power skills like MP or TP.
<Resource 0, 9>
<Resource BattleEnd: 0>
<Custom Turn Start Effect>
if (target.isAlive()) {
user.adjustSR(331, 1);
}
</Custom Turn Start Effect>

Skill - Time Freeze. Self targeting. This skill can be used without Tempest of Time or Temporal, but only adds state 118, if from 0-4 stacks it'll add state 118, if 5-8 stacks it'll add state 119 instead, and if it's at 9 stacks it'll add state 120.
<Custom Execution>
var r = user.getSR(331);
user.addState(r<5?118:r<9?119:120);
</Custom Execution>

<After Eval>
b.adjustSR(331, -9)
</After Eval>

Original thread: https://forums.rpgmakerweb.com/threads/solved-yanfly-plugins-trying-to-alter-stockpile-tips-and-tricks.75123/