Crash When Walking With State

upload_2018-4-28_12-55-2.png

This is what I get when I take a step on the overworld with a state applied, that is removable by walking.
There:
Spoiler: code
def update_state_steps(state)
if state.remove_by_walking
@state_steps[state.id] -= 1 if @state_steps[state.id] > 0
remove_state(state.id) if @state_steps[state.id] == 0
end
end
I'm using following scripts:

https://forums.rpgmakerweb.com/inde...-hit-count-removal-1-0-1-1.14229/#post-185154
https://yanflychannel.wordpress.com/rmvxa/gameplay-scripts/buff-state-manager/
https://yanflychannel.wordpress.com/rmvxa/battle-scripts/lunatic-states/


The first one had same exact error before, so I tried fixing that line like this:
Spoiler: code
def update_state_steps(state)
if state.remove_by_walking
@state_steps[state.id] -= 1 if (@state_steps[state.id] || 0) > 0
remove_state(state.id) if @state_steps[state.id] == 0
end
end

and it worked, but now EVERY time I get a step, I get State Remains message typed out.

Original thread: https://forums.rpgmakerweb.com/threads/crash-when-walking-with-state.94630/