If you have another global script, combine DayNight_Example with that by putting the two DayNight_ functions in the same relative places.
Constants:
Set up the following constants as needed:
- DAYNIGHT_USE_SYSTEM_CLOCK: Set to 1 if you want to sync the in-game timer with the system clock.
- DMF_TIME_CAN_ADVANCE: Set to a DMap flag you want to use for DMaps where time can advance. Use the DMF_ constants in std.zh for this.
- DAYNIGHT_STARTING_HOUR: The hour (1-24) the clock starts on.
Palette Transition Constants:
The following are constants for the number of extra interpolated palettes in the animation between each of the main palettes. If positive they'll cycle down on the palette list, if negative they'll cycle up. To not use any extra palettes for cycling, set these to 0.
- SUNSET_START_PALETTES: Number of extra palettes from Day->Sunset
- SUNSET_END_PALETTES: Number of extra palettes from Sunset->Night
- SUNRISE_START_PALETTES: Number of extra palettes from Night->Sunrise
- SUNRISE_END_PALETTES: Number of extra palettes from Sunrise->Day
Time Increment Constants:
These control how fast time advances on the clock. These are unused if you're using the system clock.
- DAYNIGHT_TIME_INCREMENT_FRAMES: How many in-game frames between every clock update
- DAYNIGHT_TIME_INCREMENT_SECONDS: How many seconds to add to the clock on each update
- DAYNIGHT_TIME_INCREMENT_MINUTES: How many minutes to add to the clock on each update
- DAYNIGHT_TIME_INCREMENT_HOURS: How many hours to add to the clock on each update
Subscreen Clock Constants:
These control the digital clock that's drawn to the subscreen.
- DAYNIGHT_DRAW_CLOCK: Set to 1 to draw the clock, 0 to hide it.
- DAYNIGHT_CLOCK_LAYER: What layer to draw the clock to. With modern rulesets, this should be 7.
- DAYNIGHT_CLOCK_X: X position to draw the clock to.
- DAYNIGHT_CLOCK_Y: Y position to draw the clock to. The subscreen is 56 pixels tall, so start from -56.
- DAYNIGHT_CLOCK_PLACES: How many places to show. 0 for hours only, 1 for hours and minutes, 2 for hours, minutes, and seconds.
- DAYNIGHT_CLOCK_HIDE_AM_PM: Whether or not to show AM and PM on the clock. If 0, they'll be shown, if 1 they'll be hidden, and if 2 the display will show as Military Time.
- FONT_DAYNIGHT_CLOCK: The font to draw the clock in. Use FONT_ constants from std.zh.
- C_DAYNIGHT_CLOCK: The color to draw the clock in.
- C_DAYNIGHT_CLOCK_SHADOW: The color for the clock's shadow, if applicable.
- SHD_DAYNIGHT_CLOCK_SHADOWTYPE: The type of shadow, if applicable. Use the SHD_ constants from std.zh.
Timing Control Constants:
You can tweak the timings for fading from day to night and changing music with the following constants. They come in sets of three from Start->Middle->End.
- DAYNIGHT_SUNSET_START_HOUR
- DAYNIGHT_SUNSET_MID_HOUR
- DAYNIGHT_SUNSET_END_HOUR
- DAYNIGHT_SUNRISE_START_HOUR
- DAYNIGHT_SUNRISE_MID_HOUR
- DAYNIGHT_SUNRISE_END_HOUR
- DAYNIGHT_MIDI_NIGHT_START_HOUR
- DAYNIGHT_MIDI_NIGHT_MID_HOUR
- DAYNIGHT_MIDI_NIGHT_END_HOUR
DayNight_ConfigureDMap:
This is an FFC script to configure DMaps for the global script. It only needs to run once per DMap, so place these in a place where the player is certain to cross by them.
- D0: Set this to the DMap to assign settings for. If it's the same DMap this FFC is encountered in, you can set this to -1.
- D1: The palette for Daytime. (These four palettes should be placed in the Level Palettes list next to any transition palettes you're using, for example going from Day->Sunset Transition 1->Sunset->Sunset Transition 2->Night)
- D2: The palette for Sunset
- D3: The palette for Night
- D4: The palette for Sunrise (Usually this will be the same as sunset, but I left the possibility open for them to be different)
- D5: The music to play during the Day. If this is left at 0, Day and Night won't have different music. If it's a positive number, it will use that numbered MIDI. If it's negative, it will use an enhanced music file name contained in a ZQuest string.
- D6: Same as above but for the Night music.
DayNight_ChangeWarp:
This is an FFC script to change warps on the screen based on the time of day. It will revert back to the default warp when not within that time span. Duration of the time span must be less than 12 hours, so always use this script on whichever state takes less time.
- D0: If 0, change a tile warp, if 1, change a side warp.
- D1: Which letter warp to change:
- D2: The starting time for the warp change. Whole numbers are used for hours and the first two decimal places are used for minutes. So for example, 6.0500 would result in 6:05.
- D3: The ending time for the warp change.
- D4: Which DMap to warp to (-1 for the same as set in the editor)
- D5: Which screen to warp to (in decimal) (-1 for the same as set in the editor)
DayNight_TriggerSecrets
This is an FFC script to trigger secrets when within a certain time.
- D0: The starting time for the secret. Whole numbers are used for hours and the first two decimal places are used for minutes. So for example, 6.0500 would result in 6:05.
- D1: The ending time for the secret.
- D2: Set to 1 to make the secret permanent after leaving the screen.
- D3: Set to a sound to play when the secret is triggered. The sound will only play if Link is on the screen when the timer enters the secret trigger window.
DayNight_SetTime
This is an FFC script to set the time when Link enters the screen. Useful for cutscenes that need to update the time of day afterwards.
- D0: What hour to set the clock to
- D1: What minute to set the clock to
- D2: What second to set the clock to
This script only requires std.zh.