[ACE] Yanfly Battle System State Error

hello guys, I am using Yanfly's Ace Battle Engine with the Free Turn Battle AddOn and a lot of other Yanfly scripts.

but now, while I wanted to test my monster behaviour during battle, I got a game crash, everytime a monster inflicts the character with a state like poison, paralysis etc.

I made a gif to show what I mean: GIF here!

I looked up the scripts and the line the error message says, but I couldn't find anything (due to lack of ruby knowledge and/or everything looks fine for me...)

this are (for me..) possible scripts I use, that could throw the error too:

- Yanfly's State Animations

- Yanfly's Buff and State Manager

- Yanfly's Passive States

as I said, I don't know, which object is nil and why it is nil. I hope someone can help me with this. 

Oh and I have installed the scripts for the states but not using them currently as I wanted to test the behaviour first, so none of the states has any notetags...
Hi,

According to the position given in the error message, no remaining turns are set for one of a batters states:

@state_turns[state.id] -= 1 if @state_turns[state.id] > 0

I'm not entirely sure about it, but I think it's the "Buff and State Manager" that causes the problem, as it seems to hinder the remaining turns to get initialized when adding a state with rule set 0 (A default value for this attribute can be set in line 282).

You could try to modify line 709 from

reset_state_counts(state_id) if state_rules == 1

into

reset_state_counts(state_id) if state_rules <= 1

and see if the error disappears.

Changes to the script editor are not reflected in (battle-) test mode until the project is saved.
Okay, changed line 709 as you mentioned and tested it a few times, seems to solve the problem.

Thank you very much! =)

I think I leave this thread open, this problem could occur again maybe, since I just do a quick test.

Original thread: https://forums.rpgmakerweb.com/threads/ace-yanfly-battle-system-state-error.38254/