Resetting Self Switches? 'Daily Reset' mechanic?

So, I'm a beginner playing around with the software, going fairly smoothly, but I have a bit of an issue. I'm trying to work on some basic farming sim mechanics, starting with collecting milk from animals.

My initial plan was when the player interacted with the animal and received milk, a switch would trigger, prompting a message explaining that the animal could not be milked again until tomorrow.

I added a "going to bed" event on the bed that reset this switch, allowing the player to collect milk "the next day"

However I realize will get messy once more animals are added into the equation, as each animal's daily resource would have to be it's own switch.

I was wondering if there was an easier/more concise way to do this "daily reset" mechanic?

I played around with the self switches as that concept seemed to fit what I was going for better, but then realized that self switches are supposed to be permanent, single use type of switches. Is there a way to make the "go to bed" event force these self switches to turn back off?
You can use a script call to control other events' self switches, where value is true to turn it on and false to turn it off:
Code:
$gameSelfSwitches.setValue([mapId, eventId, switchId], value);

So for example, let's say the cow is on map 1, its event id is 5, and you had turned on self switch A when milking the cow. In your "going to bed' event, you can use the following code in script call to turn that self-switch off:
Code:
$gameSelfSwitches.setValue([1, 5, 'A'], false);

You can copy-and-paste the code above and just change the mapIds and eventIds for all the animal events.

If you're familiar with Javascript or would like to learn more, you can put the eventIds in an array; see the script call list here for "Turn on/off self switches (range)":
https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mv-mz-script-call-list.46456/
So, I'm a beginner playing around with the software, going fairly smoothly, but I have a bit of an issue. I'm trying to work on some basic farming sim mechanics, starting with collecting milk from animals.

My initial plan was when the player interacted with the animal and received milk, a switch would trigger, prompting a message explaining that the animal could not be milked again until tomorrow.

I added a "going to bed" event on the bed that reset this switch, allowing the player to collect milk "the next day"

However I realize will get messy once more animals are added into the equation, as each animal's daily resource would have to be it's own switch.

I was wondering if there was an easier/more concise way to do this "daily reset" mechanic?

I played around with the self switches as that concept seemed to fit what I was going for better, but then realized that self switches are supposed to be permanent, single use type of switches. Is there a way to make the "go to bed" event force these self switches to turn back off?
I've actually submitted a tutorial for how to create events for timer-based respawning gathering nodes which would be perfect for this, just waiting for approval.
You can use a script call to control other events' self switches, where value is true to turn it on and false to turn it off:
Code:
$gameSelfSwitches.setValue([mapId, eventId, switchId], value);

So for example, let's say the cow is on map 1, its event id is 5, and you had turned on self switch A when milking the cow. In your "going to bed' event, you can use the following code in script call to turn that self-switch off:
Code:
$gameSelfSwitches.setValue([1, 5, 'A'], false);

You can copy-and-paste the code above and just change the mapIds and eventIds for all the animal events.

If you're familiar with Javascript or would like to learn more, you can put the eventIds in an array; see the script call list here for "Turn on/off self switches (range)":
https://forums.rpgmakerweb.com/index.php?threads/rpg-maker-mv-mz-script-call-list.46456/
Thank you for replying! It means a lot. So, I would use the above code in the event page, under the "script" command? And I would need a line for each animal?
@Serpenking yes, use "Script" on the 3rd page of the event commands. You can type in multiple script calls in the box that pops up, but there's a limited number of lines available (maybe 10-12?). But you can type in multiple things on one line; just make sure each script call is separated by a semi-colon, e.g.:
Code:
$gameSelfSwitches.setValue([1, 5, 'A'], false); $gameSelfSwitches.setValue([2, 3, 'B'], false);

If you end up using all the lines in that box, just use another script command after that. (Or you can use a for loop with the eventIds in an array as mentioned earlier to keep things more succinct.)
@Serpenking yes, use "Script" on the 3rd page of the event commands. You can type in multiple script calls in the box that pops up, but there's a limited number of lines available (maybe 10-12?). But you can type in multiple things on one line; just make sure each script call is separated by a semi-colon, e.g.:
Code:
$gameSelfSwitches.setValue([1, 5, 'A'], false); $gameSelfSwitches.setValue([2, 3, 'B'], false);

If you end up using all the lines in that box, just use another script command after that. (Or you can use a for loop with the eventIds in an array as mentioned earlier to keep things more succinct.)
Once again thank you! That clears things up! I really appreciate it.

Original thread: https://forums.rpgmakerweb.com/threads/resetting-self-switches-daily-reset-mechanic.144194/