Is there a way to reset an event based on my time system? More info inside.

Hey, I am always grateful for the amount of help I get from this forum.

I'm not sure if this needs a script or not.

I will work on a system where A player can buy a house and rent it out and have them collect gold every 7 days in-game time.

Time system for reference: Once 24 hours hits it = to 1 day
1617206906261.png


Now, in theory, I can do IF day = 7: grabrent on. Collect a payment, grabrentoff. I know, in theory, I could do conditional branches if I'm correct and set it 7, 14, 21, and so on.

My question is, is there a way to simplify this and make it Turn the switch on every multiple of 7? or do I need a script?

Thank you, and I hope I made sense. I appreciate it in advance.
If you never reset your day count, you could use mod, or modulo. Every time you increase the day, see if day mod 7 = 0(I think it would be dayvariable % 7 in script, but there's a way in the control variable event command, too). Mod returns a remainder after dividing two numbers, so if day mod 7 equals 0, it's a multiple of 7.
If you never reset your day count, you could use mod, or modulo. Every time you increase the day, see if day mod 7 = 0(I think it would be dayvariable % 7 in script, but there's a way in the control variable event command, too). Mod returns a remainder after dividing two numbers, so if day mod 7 equals 0, it's a multiple of 7.

Firstly, thank you for replying!

I have never used the Mod option before. I'm noob I am sorry. I haven't really used scripting but with event selection this is how it looks like

1617213102729.png


I also realized there is an option for "Multi" would that work too?


1617213170736.png


Though, i'm not sure how this works in a condtional branch or how I'd be able to turn on switch deppendent on Control variable mod.
Not very sure but I found this, "n" shows all the multiples in console and "multiples" shows how many multiples are between 1-100. Hope this can help!
Spoiler
JavaScript:
function multiple(n, multiple)
{
     resto = n % multiple;
     if(resto==0){
         console.log(n);
         return true;
}else{
         return false;
}}


var multiples=[];


for(var i=1;i<=100;i++)
{
     if(multiple(i,7)){
         multiples.push(i);
     }

}
console.log("Multiples of 7:", multiples)
Firstly, thank you for replying!

I have never used the Mod option before. I'm noob I am sorry. I haven't really used scripting but with event selection this is how it looks like

View attachment 184565

I also realized there is an option for "Multi" would that work too?


View attachment 184566

Though, i'm not sure how this works in a condtional branch or how I'd be able to turn on switch deppendent on Control variable mod.
If you're talking about "Multi" in the control variables command, that's for multiplication.
In scripting, * is multiplication, / is division, and % is mod. The event command "shorthand" you see uses the script operators in the display.

If you use the event command you show at the beginning, it will make your Day variable be the mod result, which you DON'T want, because that will overwrite your day count. You want to set another variable to Day's amount, then mod the new variable and check THAT in your event.

Basically, set any old variable you're not using equal to the value of your day variable. Then mod the new variable, which will set its value to the remainder. Then, check the value in a conditional branch. If that value is 0, turn your switch on.
Not very sure but I found this, "n" shows all the multiples in console and "multiples" shows how many multiples are between 1-100. Hope this can help!
Spoiler
JavaScript:
function multiple(n, multiple)
{
     resto = n % multiple;
     if(resto==0){
         console.log(n);
         return true;
}else{
         return false;
}}


var multiples=[];


for(var i=1;i<=100;i++)
{
     if(multiple(i,7)){
         multiples.push(i);
     }

}
console.log("Multiples of 7:", multiples)
Interesting! to be honest, I wouldn't even know where to begin by using this. Sorry, I need to learn since things like this is great =0. Thank you!
If you're talking about "Multi" in the control variables command, that's for multiplication.
In scripting, * is multiplication, / is division, and % is mod. The event command "shorthand" you see uses the script operators in the display.

If you use the event command you show at the beginning, it will make your Day variable be the mod result, which you DON'T want, because that will overwrite your day count. You want to set another variable to Day's amount, then mod the new variable and check THAT in your event.

Basically, set any old variable you're not using equal to the value of your day variable. Then mod the new variable, which will set its value to the remainder. Then, check the value in a conditional branch. If that value is 0, turn your switch on.
oh! Thank you for explaining it to me!

Hmm, something like this? forgive me if it's wrong. I may be overthinking it.


1617215076100.png




Spoiler: Solution
1617218214964.png


THANK YOU THIS WORKS PERFECTLY OMG.
Thread closed

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-reset-an-event-based-on-my-time-system-more-info-inside.134960/