Need help with lua script to only work at night

Got a zombie/corpse spawner that works great just wanted it to only work at night till dawn if that’s possible. Wondering if there was a simple command to input to stop the resource from working during the day new at this so bare with me. It’s a lua script.

The easiest way is to edit the lua script and include additional check for in-game time. You don’t need to start/stop resource for such a purpose.

Something along the lines of

if GetClockHours() < 3 or GetClockHours() > 23 then

should do what you are looking for

Where would I put this? Beginning of config lua? Sorry just new to this and not sure how to proceed. Thanks for the help btw. I appreciate it alot.

I’m certainly not a good coder. My skillset is more in the 3d area, but i used this nested in a while loop with a delay, to check the time periodically before the condition is met and the rest of your code executes. In my case it spawns my vampire with all his config flags and stuff. This would be placed at the beginning of your zombie spawn section, and would stop it from running the spawns unless the time condition is met. You may want to alter the times to suit your needs. Hope that helps!

I tried a couple different ways couldn’t get it to work but found another script that worked out so it was fine thanks for the help tho. Learned something new from it.