Quick Reply
Search this Thread
Forum Resident
Original Poster
#1 Old 4th Oct 2025 at 4:29 AM Last edited by KittyCarey : 4th Oct 2025 at 9:42 AM.
Default Making a mod run at 1am
I'm making a new mod (I have too many projects on the go...) and I need some code to run without player input:

(a) when the time on a residential/apartment/dorm lot hits 1am

and (b) at the beginning of the ageing up process.

Any tips on which bhav to insert my extra code?

Many thanks.

Edit: I've worked out the ageing up version, via a great big bhav called Age Transition. But I'm still not sure what to use to make it run at 1am. I guess I can just leave it with the manual update version, but it would be easier to have it happen automatically as well.
Lab Assistant
#2 Old 5th Oct 2025 at 3:12 PM
You could create a global controller that runs every hour to check the time, and if it's 1am then it runs the code. You can clone one from an existing mod and then just change the guid and the bhav's code.
Forum Resident
Original Poster
#3 Old 6th Oct 2025 at 7:11 AM
Quote: Originally posted by lingeringwillx
You could create a global controller that runs every hour to check the time, and if it's 1am then it runs the code. You can clone one from an existing mod and then just change the guid and the bhav's code.


Thanks very much. Can you recommend a mod with a global controller that I could copy?
Lab Assistant
#4 Old 7th Oct 2025 at 4:57 AM
Quote: Originally posted by KittyCarey
Thanks very much. Can you recommend a mod with a global controller that I could copy?

Looking at some of my older mods this one has a controller. The code would go into Function - Main.
Forum Resident
Original Poster
#5 Old 7th Oct 2025 at 1:23 PM
Quote: Originally posted by lingeringwillx
Looking at some of my older mods this one has a controller. The code would go into Function - Main.


Thanks very much. So if I copy over "Reinitialize Controller" OBJD and NREF, the OBJf file, and "Function - Main" will that do? Or do I also need "Reinitialize Token"? Obviously change the GUID.

And in "Function - Main", I assume I want to get straight into the hour check and running the various things I need, then "Idle - Minutes" for 60 minutes, and then loop round again?

Thank you very much for your help.
Top Secret Researcher
#6 Old 8th Oct 2025 at 2:10 AM
A vanilla controller in the game that does almost nothing is "Controller - Maintenance" (0xAC09FCAB, 0x7F67180D). You can clone this, but don't modify it directly to avoid conflicts with at least 2 other mods.

If you want to synchronize to the round hour, you can look at other controllers for an example. If your task takes time to complete, the processing will shift over time.

0: idle 1
1: if second == 0 go to 3 else go to 0
2: idle 30
3: if minute == 0 go to 5 else go to 2 // choose another minute to offset slightly later
4: idle 1800
5: if hour == 1 go to 6 else go to 4
6: do stuff () // can idle inside if doing heavy tasks
7: go to 0
Lab Assistant
#7 Old 9th Oct 2025 at 2:57 AM
Quote: Originally posted by KittyCarey
Thanks very much. So if I copy over "Reinitialize Controller" OBJD and NREF, the OBJf file, and "Function - Main" will that do? Or do I also need "Reinitialize Token"? Obviously change the GUID.

And in "Function - Main", I assume I want to get straight into the hour check and running the various things I need, then "Idle - Minutes" for 60 minutes, and then loop round again?

Thank you very much for your help.

Yes, the token is unrelated.

Yes, idling for 1 hour is an option. It might also be possible to calculate the time left to reach 1 am and idle for exactly that much time, but that's more difficult, and I don't know if any bugs would occur from it.
Forum Resident
Original Poster
#8 Old 9th Oct 2025 at 11:31 AM
Thank you both. It doesn't need to be exactly 1am, just around that time. I will have a go and see what I can get working.
Back to top