Multi-use action sequence issues.

So I'm trying to make an action sequence that can be used by all spells of the same element (one for fire, one for ice, etc.) Currently, the basic functionality of the action sequence works: it plays the animation, deals damage and actor animates.

What i'm having trouble with is the secondary effects. My plan is to have perks in the form of passive states that the action sequence reads to determine which secondary effect to apply, if any. for the chance to apply, I'm using a random number between 1 and 100, and comparing it to a value that has been predetermined. My current method, however, doesn't seem to be working.

What I have right now is the following script in a Conditional Branch:
Code:
$gameActors.actor($gameVariables.value(1)).states().includes($dataStates[$gameVariables.value(2)])
where Variable 1 is a temp variable set to the Last Actor ID to Act and Variable 2 is a temp variable set to the StateID of the passive state, both declared earlier in the action sequences. This is intended to check if the passive state is on the actor to trigger the secondary effect corresponding to that state.

Then in the notetag of the skill I have the following:
Code:
<JS Pre-Apply>
$gameVariables.setValue(6,100);
</JS Pre-Apply>
Variable 6 is a temp variable, and the 100 is the chance (set to 100 here mainly for testing)

Unfortunately, the branch for the secondary effect is getting skipped over, even when the actor has the passive state applied.

As is common with a fair number of my posts on this forum, the main issue is my lack of programming knowledge. I'm not sure if the reason it isn't working is because of poorly written syntax, incompatability with the methods I'm using, or some other issue I'm not aware of. Any help is greatly appreciated.
You don't show the code that actually checks the random chance. That seems to be the most likely point of failure.
Try using hasState($gameVariables.value(2)) instead of states().includes.
You don't show the code that actually checks the random chance. That seems to be the most likely point of failure.

The check for that was just a simple comparison of Variable 6(chance) and Variable 2(random number), seeing if 2 is less than or equal to 6. I guess I thought it would be obvious, so I didn't include it.

Try using hasState($gameVariables.value(2)) instead of states().includes.

That seems to have done the trick! Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/multi-use-action-sequence-issues.154863/