How would I create a state that occurs based on game time?

I'd like to create a state that is applied to the player character after X amount of time has passed, and that lasts for Y amount of time, and then repeats. So, as an example of what I would like to achieve: Every 4 hours, the player is subject to a curse. The curse will last 1 hour (applying some status effects), and then end. Another 4 hours pass, then the curse happens again and lasts for 1 hour. And so on, and so on, throughout the entirety of the game (unless a curse breaking potion or item is used). How would I go about doing this with the common event system? I already have a basic time system set up in my game (with minutes, hours, days, and weeks variables established) just using events, so I feel like this should be possible without creating a plug-in script, but this is eluding me. Any help, advice, or insight would be very appreciated!
This has nothing to do with creating the state, it goes completely over into the events to decide when to apply or remove the state from the actor.

As such, it depends on how your time system works.
The best way would be to add a few conditions to the event that updates the hour variable.
When it is updated, check if it is the hour when the state gets affective (which would be every five hours and you could check that with a modulo 5 operation if it results in 0), and if yes apply the state.
And one hour later (which would be when the modulo 5 returns 1 instead of 0) remove the state again.

if you don't want it to be fixed to the hour or if there are other conditions, you would need to describe that in more detail before we can give you better tips.
Thanks for the reply, Andar.

I used the time system by SumRndmDde:
Spoiler: Time System Common Event
◆Wait:60 frames
◆Control Variables:#0001 Minutes += 1
◆If:Minutes ≥ 60
◆Control Variables:#0002 Hours += 1
◆Control Variables:#0001 Minutes = 0
◆
:End
◆If:Hours = 24
◆Control Variables:#0003 Days += 1
◆Control Variables:#0002 Hours = 0
◆
:End
◆If:Days = 7
◆Control Variables:#0004 Weeks += 1
◆Control Variables:#0003 Days = 0
◆
:End
The part that I don't understand is what option in the event system allows me to check for the passing of X hours, rather than just checking for the hour labeled X. So not just at hour 5 do this, as that would mean every day at hour 5 the state would turn on. Rather I want to check if 5 hours have passed, turn on the state. Let state continue for 1 hour, and after that hour is up, turn the state off. Then repeat infinitely, until the player finishes the game. (The actual duration of the time doesn't matter to me at the moment, I just want the functionality so I can test what time feels right when playing.) Hopefully that explains better what I'm asking for help.
Actually, thinking more about what you said and after writing down a reply to you, I think I've been thinking about it wrong! I may actually have figured out what I want to accomplish, like you said with just conditions.
as I said above the simplest way for that is to use the modulo operation of the control variable command. Modulo is not as well known a mathematical operation as addition or division, but in these cases it's the one that saves the day.
as I said above the simplest way for that is to use the modulo operation of the control variable command. Modulo is not as well known a mathematical operation as addition or division, but in these cases it's the one that saves the day.
Modulo is "Mod" at the end of the list in the Operations section of Control Variables, yes?
So you are saying do something like this?
◆Control Variables:#0001 Minutes %= 5
◆Change State:Entire Party, + #0005
◆Control Variables:#0001 Minutes %= 1
◆Change State:Entire Party, - #0005
Modulo means "rest after division" (as a quick explanation).
So if a number is divisable by 5, the rest will be zero (which means a check on the result = 0 will trigger on hour 0, 5, 10, 15, 20 and so on.

And the second check for result = 1 will trigger on the hours 1, 6, 11 and so on, because if you divide 11 by 5 you get 2 full numbers and a modulo rest of 1.

In your code, you need to check the result of the modulo operation, and that means you need to place the number in a temporary variable (not change the original variables) and then check that temporary variable with conditional branches

Original thread: https://forums.rpgmakerweb.com/threads/how-would-i-create-a-state-that-occurs-based-on-game-time.76334/