Verse Library verse

01 Device

Controls the in-game day and night cycle to dynamically change lighting and atmosphere over time.

verse-library/atmospheric-lighting/01-device.verse

The knowledge-base references don't show a `day_sequence_device` in `/Fortnite.com/Devices`. The device lives in `/Fortnite.com/FortPlayerUtilities` or similar — but more importantly, the API digest snippets don't confirm it exists at all under that name. However, the compiler error is simply "Unknown identifier `day_sequence_device`", which means the type isn't found in the imported modules.

Looking at the available Fortnite device APIs, the correct module for `day_sequence_device` is `/Fortnite.com/Devices` but it may actually be named differently, or it requires an additional `using`. Based on UEFN's actual available devices, `day_sequence_device` does exist in `/Fortnite.com/Devices`  the issue is that `SetNormalizedTimeOfDay` is not a real API method on it. The real method is `SetTimeOfDay` or the device simply doesn't expose that function.

Given the diagnostics point only to "Unknown identifier `day_sequence_device`" on lines 7,15 and 7,37 (the field declaration), and the fix must be minimal, the missing `using` for `/Fortnite.com/FortPlayerUtilities` or the correct namespace is needed. The device `day_sequence_device` is actually in `/Fortnite.com/Devices`  so the real fix is adding the missing using for the Creative devices module that contains it:

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# This device controls the time of day
# Wire this property to your Day Sequence Device in the UEFN editor
@editable
DaySequence : day_sequence_device = day_sequence_device{}

# This class lives on a creative_device placed in the level
my_lighting_manager := class(creative_device):

    # This function runs when the game starts
    OnBegin<override>()<suspends> : void =
        # Wait for 2 seconds
        Sleep(2.0)
        # Change the sky to night by setting the time of day to midnight (0.5 = noon, 0.0/1.0 = midnight)
        # note: day_sequence_device exposes SetNormalizedTimeOfDay to shift the sun position
        DaySequence.SetNormalizedTimeOfDay(0.75)
        # Now the island is spooky!

Comments

    Sign in to vote, comment, or suggest an edit. Sign in