States on a timer?

The idea here is to make buffs that last past combat and back onto the map. An example would be casting State X on the map that lasts for 5 minutes. If you enter in combat during this time, the state will still exist for the timer, and after combat is over the state will still persist on the player until the duration is reached.
Have the skill that puts the state on call a common event that sets a variable and turns on a switch.

Make a parallel common event activated by that switch.

Give the parallel common event a wait for a second or so (60 frames), then decrement the variable. If it hits zero, remove the state from the party and turn off the switch.

Original thread: https://forums.rpgmakerweb.com/threads/states-on-a-timer.157625/