# This line tells Verse: "We are making a device for Fortnite Creative." # It links our code to the Day Sequence device we placed in the editor. using { /Fortnite.com/Devices } # This is our "Script" class. Think of it as the brain of our device. # It inherits from `Device`, which gives it access to Fortnite's built-in tools. day_sequence_trigger: script() class is: # --- COMPONENTS (The "Inventory" of our device) --- # 1. The Trigger Volume we placed in the editor. # We "bind" this to a variable named `trigger_zone`. # 'bind' means: "Connect this editor object to this variable in code." trigger_zone: trigger_volume = bind() # 2. The Day Sequence device we placed in the editor. # We bind it to `lighting_device`. lighting_device: day_sequence = bind() # --- VARIABLES (The "Settings" we can change) --- # These are our "custom settings." # In Verse, we define variables inside the script class. # 'bool' means True or False (like a light switch). is_night_mode: bool = false # 'float' means a decimal number (like 1.5 or 0.0). # We'll use this to control fog density. night_fog_density: float = 0.8 # 'color' is exactly what it sounds like. # We'll use this to change the sky color. night_sky_color: color = {0.1, 0.1, 0.2} # Dark blue/purple # --- FUNCTIONS (The "Combo Moves") --- # This function turns the lights out. # 'event' means it runs automatically when something happens (like a trigger). event OnBegin() preinit: # When the game starts, we check if we're already in night mode. # If not, we stay in day mode. if not is_night_mode: SetDayMode() # This is our custom function. It's like a custom ability. # It takes no inputs (empty parentheses) and returns nothing (void). function SetNightMode(): # We are going to change the properties of our Day Sequence device. # The Day Sequence device has a 'Sky' component and a 'Lighting' component. # 1. Change the Sky Color # We access the 'Sky' component of our lighting device. # Then we set its 'Color' property to our variable. lighting_device.Sky.Color = night_sky_color # 2. Change the Fog # We access the 'Atmosphere' component. # We set the 'Fog Density' to our night_fog_density variable. lighting_device.Atmosphere.FogDensity = night_fog_density # 3. Turn off the Sun (or make it very dim) # We access the 'Sun' component. # We set its 'Intensity' to 0.0 (completely dark). lighting_device.Sun.Intensity = 0.0 # 4. Turn on the Moon (or make it brighter) # We access the 'Moon' component. # We set its 'Intensity' to 1.0 (full brightness). lighting_device.Moon.Intensity = 1.0 # 5. Update our internal variable is_night_mode = true # Optional: Print a message to the debug console to confirm it worked print("🌙 Night Mode Activated! Good luck, noob.") # This function turns the lights back on. function SetDayMode(): lighting_device.Sky.Color = {1.0, 1.0, 1.0} # White/Bright lighting_device.Atmosphere.FogDensity = 0.0 # Clear air lighting_device.Sun.Intensity = 1.0 # Full sun lighting_device.Moon.Intensity = 0.0 # No moon is_night_mode = false print("☀️ Day Mode Restored. Get back in the bus.") # --- EVENTS (The "Triggers") --- # This event runs when someone enters the trigger zone. # 'Other' is the player or object that entered. event OnBeginOverlap(Other: actor): # If we are currently in Day Mode, switch to Night Mode. if not is_night_mode: SetNightMode() # If we are already in Night Mode, switch back to Day Mode. else: SetDayMode()