VerseIsland
Feed Learn Leaderboard Guides Reference Explore Search Docs Verse Library
Sign in
Feed Learn 📖 Codex Leaderboard Guides Reference Explore Search Docs Verse Library
Verse Library › Devices
Browse Verse Library

Library

Devices 634
  • Devices171
  • Triggers & Logic118
  • UI & HUD40
  • Audio39
  • Items & Inventory29
  • Events27
  • Scoring & Objectives25
  • Spawning19
  • Classes & Interfaces18
  • Game Modes17
  • Props & Meshes14
  • Variables & Mutability12
  • Player Management11
  • Modules & Structure10
  • Round Flow8
  • Animation6
  • Concurrency6
  • Functions6
  • Getting Started6
  • Teams & Classes6
  • NPCs & AI5
  • Tutorials5
  • VFX & Particles5
  • Arrays & Maps4
  • Cameras4
  • Debugging4
  • Control Flow3
  • Cinematics2
  • Other2
  • Persistence2
  • Scene Graph2
  • Structs & Enums2
  • Building1
  • Physics1
  • Publishing & Islands1
  • Syntax & Types1
  • Vehicles1
  • Weapons1
Verse Language 257
  • Control Flow35
  • Functions26
  • Arrays & Maps25
  • Classes & Interfaces22
  • Variables & Mutability22
  • Concurrency21
  • Syntax & Types18
  • Modules & Structure12
  • Debugging8
  • Devices8
  • Events7
  • Player Management6
  • Structs & Enums6
  • Triggers & Logic6
  • Game Modes5
  • Failure & Options4
  • Scene Graph4
  • UI & HUD4
  • Getting Started3
  • Round Flow3
  • Spawning3
  • VFX & Particles3
  • Reference2
  • Animation1
  • Best Practices1
  • Other1
  • Props & Meshes1
Materials/VFX 154
  • Triggers & Logic27
  • UI & HUD17
  • Devices16
  • VFX & Particles14
  • Props & Meshes11
  • Scoring & Objectives9
  • Game Modes7
  • Items & Inventory7
  • Functions6
  • Arrays & Maps5
  • Animation3
  • Cinematics3
  • Classes & Interfaces3
  • Control Flow3
  • Events3
  • Modules & Structure3
  • Round Flow3
  • Spawning3
  • Getting Started2
  • Scene Graph2
  • Variables & Mutability2
  • Concurrency1
  • Persistence1
  • Player Management1
  • Structs & Enums1
  • Syntax & Types1
General 153
  • Devices22
  • Events20
  • Triggers & Logic20
  • Classes & Interfaces10
  • Variables & Mutability8
  • Round Flow6
  • Scoring & Objectives6
  • UI & HUD6
  • Functions5
  • Player Management5
  • Game Modes4
  • Getting Started4
  • Props & Meshes4
  • Control Flow3
  • Syntax & Types3
  • VFX & Particles3
  • Arrays & Maps2
  • Best Practices2
  • NPCs & AI2
  • Other2
  • Physics2
  • Scene Graph2
  • Spawning2
  • Structs & Enums2
  • Tutorials2
  • Building1
  • Cameras1
  • Cinematics1
  • Failure & Options1
  • Items & Inventory1
  • Teams & Classes1
Player 133
  • Player Management22
  • Teams & Classes19
  • Classes & Interfaces12
  • Devices11
  • Events9
  • Persistence7
  • Triggers & Logic7
  • Arrays & Maps6
  • Functions4
  • Game Modes4
  • Items & Inventory4
  • Round Flow4
  • Debugging3
  • Getting Started3
  • Modules & Structure3
  • Concurrency2
  • Control Flow2
  • Scoring & Objectives2
  • Spawning2
  • Structs & Enums2
  • Physics1
  • Props & Meshes1
  • UI & HUD1
  • Variables & Mutability1
  • Weapons1
Building & Props 131
  • Variables & Mutability15
  • Props & Meshes14
  • Triggers & Logic12
  • Classes & Interfaces10
  • Devices10
  • UI & HUD10
  • Events7
  • Teams & Classes7
  • Animation5
  • Building5
  • Functions5
  • VFX & Particles5
  • Structs & Enums4
  • Control Flow3
  • Game Modes3
  • Items & Inventory3
  • Round Flow3
  • Scene Graph3
  • Arrays & Maps2
  • Concurrency2
  • Reference2
  • Modules & Structure1
NPCs & AI 76
  • NPCs & AI35
  • Spawning7
  • Animation5
  • Variables & Mutability5
  • Classes & Interfaces3
  • Debugging3
  • UI & HUD3
  • Audio2
  • Concurrency2
  • Game Modes2
  • Props & Meshes2
  • Triggers & Logic2
  • Devices1
  • Functions1
  • Getting Started1
  • Reference1
  • VFX & Particles1
Spawning 73
  • Spawning31
  • Events7
  • Concurrency6
  • Player Management6
  • Vehicles5
  • Props & Meshes4
  • Devices3
  • Scene Graph3
  • Items & Inventory2
  • Teams & Classes2
  • Control Flow1
  • Publishing & Islands1
  • Reference1
  • Scoring & Objectives1
Cinematics 71
  • Cameras19
  • Cinematics15
  • Devices11
  • Audio5
  • Animation4
  • Triggers & Logic4
  • Functions2
  • Game Modes2
  • UI & HUD2
  • Classes & Interfaces1
  • Concurrency1
  • Control Flow1
  • Items & Inventory1
  • Modules & Structure1
  • Scene Graph1
  • Templates1
UI 57
  • UI & HUD35
  • Devices5
  • Scoring & Objectives4
  • Classes & Interfaces3
  • Round Flow2
  • Scene Graph2
  • Arrays & Maps1
  • Props & Meshes1
  • Structs & Enums1
  • Templates1
  • Triggers & Logic1
  • Variables & Mutability1
Scene Graph 40
  • Scene Graph9
  • Items & Inventory8
  • Classes & Interfaces3
  • Events3
  • Props & Meshes3
  • Functions2
  • Arrays & Maps1
  • Building1
  • Control Flow1
  • Debugging1
  • Modules & Structure1
  • Player Management1
  • Reference1
  • Structs & Enums1
  • Syntax & Types1
  • Triggers & Logic1
  • UI & HUD1
  • VFX & Particles1
Vehicles 38
  • Spawning11
  • Devices7
  • Vehicles7
  • Props & Meshes4
  • Functions2
  • Game Modes2
  • Failure & Options1
  • Items & Inventory1
  • Reference1
  • Teams & Classes1
  • Tutorials1
Tutorials 37
  • Game Modes6
  • Triggers & Logic5
  • Classes & Interfaces4
  • Events4
  • Props & Meshes3
  • Building2
  • Devices2
  • Items & Inventory2
  • Scoring & Objectives2
  • Animation1
  • Arrays & Maps1
  • Cameras1
  • Concurrency1
  • Physics1
  • Player Management1
  • Structs & Enums1
Weapons 30
  • Game Modes6
  • Weapons6
  • Devices5
  • Items & Inventory3
  • Scoring & Objectives3
  • Spawning2
  • Teams & Classes2
  • Best Practices1
  • Functions1
  • Triggers & Logic1
Items 28
  • Items & Inventory23
  • Devices2
  • Triggers & Logic2
  • Spawning1
Assets 20
  • Modules & Structure6
  • Arrays & Maps3
  • Functions3
  • Scene Graph2
  • Best Practices1
  • Devices1
  • Events1
  • Failure & Options1
  • Physics1
  • Variables & Mutability1
Animation 19
  • Animation10
  • Variables & Mutability4
  • Devices1
  • Player Management1
  • Props & Meshes1
  • Scene Graph1
  • Syntax & Types1
Release Notes 17
  • Classes & Interfaces5
  • Modules & Structure3
  • Concurrency2
  • Control Flow2
  • Variables & Mutability2
  • Debugging1
  • Devices1
  • Items & Inventory1
Input & Controls 16
  • Functions4
  • UI & HUD3
  • Control Flow2
  • Animation1
  • Arrays & Maps1
  • Cinematics1
  • Debugging1
  • Devices1
  • Events1
  • Items & Inventory1
Publishing 8
  • Control Flow5
  • Arrays & Maps1
  • Devices1
  • Syntax & Types1
Audio 7
  • Audio5
  • UI & HUD2
Landscape 7
  • Other4
  • VFX & Particles2
  • Scene Graph1
Persistence 6
  • Structs & Enums2
  • Items & Inventory1
  • Persistence1
  • Publishing & Islands1
  • Variables & Mutability1
Physics 5
  • Functions2
  • Classes & Interfaces1
  • Devices1
  • Syntax & Types1
Creator Economy 3
  • Publishing & Islands2
  • Modules & Structure1
Discovery 3
  • Devices1
  • NPCs & AI1
  • Structs & Enums1
Editor & Project 3
  • Other1
  • Props & Meshes1
  • Tutorials1

Real-Time API Beta

Module — 2 files
These files compile together (same module folder).
file_1.verse
# Credit: JPN: @GorosukeSan, EN: @GorosukeEN
# A follow on X (Twitter) or credit within the map would be greatly appreciated (optional)
# If you have any bug reports or feature requests, please contact the account mentioned above.

using { /Verse.org/Simulation }

ProjectTimeZone<public>:time_zone = time_zone_gmt{}

time_date<public> := struct<concrete>:
    @editable
    Year:int = 0

    @editable
    Month:int = 0
    
    @editable
    Day:int = 0

    @editable
    Hour:int = 0

    @editable
    Minute:int = 0

    @editable
    Second:int = 0

    @editable
    Millisecond:int = 0

time_span<public> := struct<concrete>:
    @editable
    Years:int = 0

    @editable
    Months:int = 0

    @editable
    Days:int = 0

    @editable
    Hours:int = 0

    @editable
    Minutes:int = 0

    @editable
    Seconds:int = 0

    @editable
    Milliseconds:int = 0

time_zone<public> := class<computes>:
    Time<public>:float

time_zone_gmt<public> := class<computes>(time_zone):
    Time<override>:float = 0.0

time_zone_tokyo<public> := class<computes>(time_zone):
    Time<override>:float = 32400.0

GetCurrentTimeDate<public>()<transacts>:time_date=
    MakeTimeDate(GetSecondsSinceEpoch())

MakeTimeDate<public>(InEpochTime:float)<transacts>:time_date=
    CurrentTime := Max(InEpochTime + ProjectTimeZone.Time, 0.0)

    EpochTimeSeconds := Floor[CurrentTime] or 0
    MilliSeconds := Mod[Floor[CurrentTime * 1000], 1000] or 0
    Seconds := Mod[EpochTimeSeconds, 60] or 0
    Minutes := Mod[Floor(EpochTimeSeconds / 60), 60] or 0
    Hours := Mod[Floor(EpochTimeSeconds / 3600), 24] or 0
    Days := Floor(EpochTimeSeconds / 86400) or 0

    var Years:int = 1970
    var TotalDays:int = Days
    loop:
        DaysInYear := 
            if(IsLeapYear[Years]):
                366
            else:
                365
        if(TotalDays >= DaysInYear):
            set TotalDays -= DaysInYear
            set Years += 1
        else:
            break

    var Month:int = 0
    loop:
        CurrentDay :=
            if(Month = 2 and IsLeapYear[Years]):
                29
            else:
                DaysInMonth[Month] or 0
                
        if(TotalDays >= CurrentDay):
            set TotalDays -= CurrentDay
            set Month += 1
        else:
            break

    time_date:
        Year := Years
        Month := Month + 1
        Day := TotalDays + 1
        Hour := Hours
        Minute := Minutes
        Second := Seconds
        Millisecond := MilliSeconds

(InTimeDate:time_date).ToFloat<public>()<transacts>:float=
    var TotalDays:int = 0
    for:
        CurrentYear := 1970..InTimeDate.Year - 1
    do:
        set TotalDays += 
            if(IsLeapYear[CurrentYear]):
                366
            else:
                365

    for:
        CurrentMonthIndex := 0..InTimeDate.Month - 1 - 1
        CurrentDays := DaysInMonth[CurrentMonthIndex]
    do:
        set TotalDays += 
            if(CurrentMonthIndex = 1 and IsLeapYear[InTimeDate.Year]):
                29
            else:
                CurrentDays

    var TotalSeconds:float = (TotalDays * 86400.0)
    set TotalSeconds += (InTimeDate.Day - 1) * 86400.0
    set TotalSeconds += InTimeDate.Hour * 3600.0
    set TotalSeconds += InTimeDate.Minute * 60.0
    set TotalSeconds += InTimeDate.Second * 1.0
    set TotalSeconds += InTimeDate.Millisecond * 0.001
    set TotalSeconds -= ProjectTimeZone.Time
    TotalSeconds

MakeTimeSpan<public>(InTime:float)<transacts>:time_span=
    CurrentTime := Max(InTime, 0.0)

    TimeSeconds := Floor[CurrentTime] or 0
    MilliSeconds := Mod[Floor(TimeSeconds * 1000), 1000] or 0
    Seconds := Mod[TimeSeconds, 60] or 0
    Minutes := Mod[Floor(TimeSeconds / 60), 60] or 0
    Hours := Mod[Floor(TimeSeconds / 3600), 24] or 0
    Days := Floor(TimeSeconds / 86400) or 0
    
    var Years:int = 0
    var TotalDays:int = Days
    loop:
        DaysInYear := 
            if(IsLeapYear[Years]):
                366
            else:
                365
        if(TotalDays >= DaysInYear):
            set TotalDays -= DaysInYear
            set Years += 1
        else:
            break

    var Month:int = 0
    loop:
        CurrentDay :=
            if(Month = 2 and IsLeapYear[Years]):
                29
            else:
                DaysInMonth[Month] or 0
                
        if(TotalDays >= CurrentDay):
            set TotalDays -= CurrentDay
            set Month += 1
        else:
            break

    time_span:
        Years := Years
        Months := Month
        Days := TotalDays
        Hours := Hours
        Minutes := Minutes
        Seconds := Seconds
        Milliseconds := MilliSeconds

(InTimeSpan:time_span).ToFloat<public>()<transacts>:float=
    var TotalDays:int = 0
    for:
        CurrentYear := 0..InTimeSpan.Years - 1
    do:
        set TotalDays += 
            if(IsLeapYear[CurrentYear]):
                366
            else:
                365

    for:
        CurrentMonthIndex := 0..InTimeSpan.Months - 1
        CurrentDays := DaysInMonth[CurrentMonthIndex]
    do:
        set TotalDays += 
            if(CurrentMonthIndex = 1 and IsLeapYear[InTimeSpan.Years]):
                29
            else:
                CurrentDays

    var TotalSeconds:float = (TotalDays * 86400.0)
    set TotalSeconds += InTimeSpan.Days * 86400.0
    set TotalSeconds += InTimeSpan.Hours * 3600.0
    set TotalSeconds += InTimeSpan.Minutes * 60.0
    set TotalSeconds += InTimeSpan.Seconds * 1.0
    set TotalSeconds += InTimeSpan.Milliseconds * 0.001
    TotalSeconds

Equal<public>(X:time_date, Y:time_date)<transacts><decides>:void=
    X.ToFloat() = Y.ToFloat()

GreaterThan<public>(X:time_date, Y:time_date)<transacts><decides>:void=
    X.ToFloat() > Y.ToFloat()

EqualOrGreaterThan<public>(X:time_date, Y:time_date)<transacts><decides>:void=
    X.ToFloat() >= Y.ToFloat()

LessThan<public>(X:time_date, Y:time_date)<transacts><decides>:void=
    X.ToFloat() < Y.ToFloat()

EqualOrLessThan<public>(X:time_date, Y:time_date)<transacts><decides>:void=
    X.ToFloat() <= Y.ToFloat()

Distance<public>(X:time_date, Y:time_date)<transacts>:time_span=
    TimeDifference := Abs(X.ToFloat() - Y.ToFloat())
    MakeTimeSpan(TimeDifference)

operator'+'<public>(X:time_date, Y:time_span)<transacts>:time_date=
    Result := X.ToFloat() + Y.ToFloat()
    MakeTimeDate(Result)

operator'-'<public>(X:time_date, Y:time_span)<transacts>:time_date=
    Result := Max(X.ToFloat() - Y.ToFloat(), 0.0)
    MakeTimeDate(Result)

operator'*'<public>(X:time_date, Y:float)<transacts>:time_span=
    Result := X.ToFloat() * Y
    MakeTimeSpan(Result)

operator'/'<public>(X:time_date, Y:float)<transacts>:time_span=
    Result := X.ToFloat() / Y
    MakeTimeSpan(Result)

operator'*'<public>(X:time_date, Y:time_span)<transacts>:time_span=
    Result := X.ToFloat() * Y.ToFloat()
    MakeTimeSpan(Result)

operator'/'<public>(X:time_date, Y:time_span)<transacts>:time_span=
    Result := X.ToFloat() / Y.ToFloat()
    MakeTimeSpan(Result)

operator'+'<public>(X:time_span, Y:time_span)<transacts>:time_span=
    Result := X.ToFloat() + Y.ToFloat()
    MakeTimeSpan(Result)

operator'-'<public>(X:time_span, Y:time_span)<transacts>:time_span=
    Result := Max(X.ToFloat() - Y.ToFloat(), 0.0)
    MakeTimeSpan(Result)

operator'*'<public>(X:time_span, Y:float)<transacts>:time_span=
    Result := X.ToFloat() * Y
    MakeTimeSpan(Result)

operator'/'<public>(X:time_span, Y:float)<transacts>:time_span=
    Result := X.ToFloat() / Y
    MakeTimeSpan(Result)

operator'*'<public>(X:time_span, Y:time_span)<transacts>:time_span=
    Result := X.ToFloat() * Y.ToFloat()
    MakeTimeSpan(Result)

operator'/'<public>(X:time_span, Y:time_span)<transacts>:time_span=
    Result := X.ToFloat() / Y.ToFloat()
    MakeTimeSpan(Result)

day_of_week<public> := enum:
    Sunday
    Monday
    Tuesday
    Wednesday
    Thursday
    Friday
    Saturday

GetDayOfWeek<public>(InTimeDate:time_date)<transacts>:day_of_week=
    TimeSeconds := InTimeDate.ToFloat()
    TotalDays := Floor[TimeSeconds / 86400.0] or 0
    DayIndex := Mod[TotalDays + 4, 7] or 0
    DayOfWeeks[DayIndex] or day_of_week.Sunday

DaysInMonth<public>:[]int = array{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
IsLeapYear<public>(InYear:int)<computes><decides>:void=
    (Mod[InYear, 4] = 0, Mod[InYear, 100] <> 0) or (Mod[InYear, 400] = 0)

DayOfWeeks<public>:[]day_of_week = array:
    day_of_week.Sunday
    day_of_week.Monday
    day_of_week.Tuesday
    day_of_week.Wednesday
    day_of_week.Thursday
    day_of_week.Friday
    day_of_week.Saturday

GetEventState<public>(Args:event_args)<transacts>:void=
    CurrentDate := GetCurrentTimeDate()
    GetEventState(CurrentDate, Args)

GetEventState<public>(Args:event_repeat_args)<transacts>:void=
    CurrentDate := GetCurrentTimeDate()
    GetEventState(CurrentDate, Args)

event_args<public> := struct:
    StartDate:time_date
    Duration:time_span

event_repeat_args<public> := struct:
    StartDate:time_date
    Duration:time_span
    Interval:time_span

event_state<public> := enum:
    NotStarted
    Ongoing
    WaitingForNext
    Ended

GetEventState<public>(InCurrentDate:time_date, Args:event_args)<transacts>:event_state=
    if:
        LessThan[InCurrentDate, Args.StartDate]
    then:
        event_state.NotStarted
    else if:
        EqualOrGreaterThan[InCurrentDate, Args.StartDate] and LessThan[InCurrentDate, Args.StartDate + Args.Duration]
    then:
        event_state.Ongoing
    else:
        event_state.Ended

GetEventState<public>(InCurrentDate:time_date, Args:event_repeat_args)<transacts>:event_state=
    if:
        LessThan[InCurrentDate, Args.StartDate]
    then:
        event_state.NotStarted
    else:
        EventStartDate := GetEventStartDate(InCurrentDate, Args)
        if:
            EqualOrGreaterThan[InCurrentDate, EventStartDate] and LessThan[InCurrentDate, EventStartDate + Args.Duration]
        then:
            event_state.Ongoing
        else:
            event_state.WaitingForNext

GetEventStartDate<public>(InCurrentDate:time_date, Args:event_repeat_args)<transacts>:time_date=
    if:
        LessThan[InCurrentDate, Args.StartDate]
    then:
        Args.StartDate
    else:
        ElapsedTime := Distance(Args.StartDate, InCurrentDate)
        Interval := Args.Duration + Args.Interval
        ElpasedSize := ElapsedTime / Interval
        TempStartTime := Args.StartDate + (Interval * ElpasedSize.ToFloat())
        if:
            EqualOrGreaterThan[InCurrentDate, TempStartTime + Args.Duration]
        then:
            TempStartTime + Interval
        else:
            TempStartTime

date_type<public> := enum:
    Year
    Month
    Day
    Hour
    Minute
    Second

(InDateType:date_type).GetTier<public>()<computes>:int=
    case(InDateType):
        date_type.Year => 0
        date_type.Month => 1
        date_type.Day => 2
        date_type.Hour => 3
        date_type.Minute => 4
        date_type.Second => 5

(InTimeDate:time_date).Override<public>(InDateType:date_type, InValue:int)<transacts>:time_date=
    ArgTier := InDateType.GetTier()
    YearTier := date_type.Year.GetTier()
    MonthTier := date_type.Month.GetTier()
    DayTier := date_type.Day.GetTier()
    HourTier := date_type.Hour.GetTier()
    MinuteTier := date_type.Minute.GetTier()
    SecondTier := date_type.Second.GetTier()

    time_date:
        Year :=
            if(ArgTier = YearTier):
                InValue
            else if(ArgTier < YearTier):
                0
            else:
                InTimeDate.Year
        Month :=
            if(ArgTier = MonthTier):
                InValue
            else if(ArgTier < MonthTier):
                1
            else:
                InTimeDate.Month
        Day :=
            if(ArgTier = DayTier):
                InValue
            else if(ArgTier < DayTier):
                1
            else:
                InTimeDate.Day
        Hour :=
            if(ArgTier = HourTier):
                InValue
            else if(ArgTier < HourTier):
                0
            else:
                InTimeDate.Hour
        Minute :=
            if(ArgTier = MinuteTier):
                InValue
            else if(ArgTier < MinuteTier):
                0
            else:
                InTimeDate.Minute
        Second :=
            if(ArgTier = SecondTier):
                InValue
            else if(ArgTier < SecondTier):
                0
            else:
                InTimeDate.Second

(InTimeDate:time_date).Today<public>()<transacts>:time_date=
    time_date:
        Year := InTimeDate.Year
        Month := InTimeDate.Month
        Day := InTimeDate.Day
        Hour := 0
        Minute := 0
        Second := 0
        Millisecond := 0

(InTimeDate:time_date).Yesterday<public>()<transacts>:time_date=
    InTimeDate.Today() - time_span{Days := 1}

(InTimeDate:time_date).Tomorrow<public>()<transacts>:time_date=
    InTimeDate.Today() + time_span{Days := 1}

(InTimeDate:time_date).Today<public>(Hour:int)<transacts>:time_date=
    if(InTimeDate.Hour < Hour):
        InTimeDate.Yesterday() + time_span{Hours := Hour}
    else:
        InTimeDate.Today() + time_span{Hours := Hour}

(InTimeDate:time_date).Tomorrow<public>(Hour:int)<transacts>:time_date=
    InTimeDate.Today(Hour) + time_span{Days := 1}

(InTimeDate:time_date).Yesterday<public>(Hour:int)<transacts>:time_date=
    InTimeDate.Today(Hour) - time_span{Days := 1}

ToString<public>(InTimeDate:time_date)<computes>:string=
    "{InTimeDate.Year}-{InTimeDate.Month}-{InTimeDate.Day} {InTimeDate.Hour}:{InTimeDate.Minute}:{InTimeDate.Second}.{InTimeDate.Millisecond}"

ToString<public>(InTimeSpan:time_span)<computes>:string=
    "{InTimeSpan.Years} years, {InTimeSpan.Months} months, {InTimeSpan.Days} days, {InTimeSpan.Hours} hours, {InTimeSpan.Minutes} minutes, {InTimeSpan.Seconds} seconds"

ToString<public>(InDateTime:day_of_week)<computes>:string=
    case(InDateTime):
        day_of_week.Sunday=> "Sunday"
        day_of_week.Monday=> "Monday"
        day_of_week.Tuesday=> "Tuesday"
        day_of_week.Wednesday=> "Wednesday"
        day_of_week.Thursday=> "Thursday"
        day_of_week.Friday=> "Friday"
        day_of_week.Saturday=> "Saturday"

ToString<public>(InDateType:date_type)<computes>:string=
    case(InDateType):
        date_type.Year=> "Year"
        date_type.Month=> "Month"
        date_type.Day=> "Day"
        date_type.Hour=> "Hour"
        date_type.Minute=> "Minute"
        date_type.Second=> "Second"

ToString<public>(InEventState:event_state)<computes>:string=
    case(InEventState):
        event_state.NotStarted=> "NotStarted"
        event_state.Ongoing=> "Ongoing"
        event_state.WaitingForNext=> "WaitingForNext"
        event_state.Ended=> "Ended"
file_2.verse
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

live_event_once_device<public> := class(creative_device):
    @editable
    StartDate<public>:time_date = time_date{}
    @editable
    Duration<public>:time_span = time_span{}
    @editable
    AnnounceHUDMessage<public>:hud_message_device = hud_message_device{}
    
    OnBegin<override>()<suspends>:void=
        var IsAnnounced:logic = false
        EventArgs := event_args:
            StartDate := StartDate
            Duration := Duration
        loop:
            Sleep(1.0)
            if:
                GetEventState(EventArgs) = event_state.Ongoing
            then:
                if:
                    not IsAnnounced?
                then:
                    AnnounceHUDMessage.Show()
                    set IsAnnounced = true

live_event_repeat_device<public> := class(creative_device):
    @editable
    StartDate<public>:time_date = time_date{}
    @editable
    Duration<public>:time_span = time_span{}
    @editable
    Interval<public>:time_span = time_span{}
    @editable
    AnnounceHUDMessage<public>:hud_message_device = hud_message_device{}
    
    OnBegin<override>()<suspends>:void=
        var IsAnnounced:logic = false
        EventArgs := event_repeat_args:
            StartDate := StartDate
            Duration := Duration
            Interval := Interval
        loop:
            Sleep(1.0)
            if:
                GetEventState(EventArgs) = event_state.Ongoing
            then:
                if:
                    not IsAnnounced?
                then:
                    AnnounceHUDMessage.Show()
                    set IsAnnounced = true
            else:
                set IsAnnounced = false

var SaveData<public>:weak_map(player, save_data) = map{}

MakeSaveData<public><constructor>(InData:save_data)<transacts> := save_data:
    LastLoginTime := InData.LastLoginTime
    ActiveQuestIDs := InData.ActiveQuestIDs

save_data<public> := class<final><persistable>:
    LastLoginTime<public>:float = 0.0
    ActiveQuestIDs<public>:[]int = array{}

daily_quest_device<public> := class(creative_device):

    @editable
    QuestTrackers:[]tracker_device = array{}

    @editable
    QuestCount:int = 3
    
    @editable
    UpdateHour:int = 21

    InitializeSaveData<public>(InPlayer:player):void=
        if:
            not SaveData[InPlayer]
        then:
            NewQuestIDs := PickQuests()
            CurrentToday := GetCurrentTimeDate().Today(UpdateHour)
            if:
                set SaveData[InPlayer] = save_data:
                    LastLoginTime := CurrentToday.ToFloat()
                    ActiveQuestIDs := NewQuestIDs

            for:
                TrackerElement : QuestTrackers
            do:
                TrackerElement.Remove(InPlayer)
            for:
                QuestID : NewQuestIDs
                TargetTracker := QuestTrackers[QuestID]
            do:
                TargetTracker.Assign(InPlayer)

    CheckQuestUpdte<public>(InPlayer:player):void=
        if:
            CurrentSaveData := SaveData[InPlayer]
        then:
            if:
                LastLoginTime := MakeTimeDate(CurrentSaveData.LastLoginTime)
                CurrentTime := GetCurrentTimeDate().Today(UpdateHour)
                Distance(LastLoginTime, CurrentTime).Days >= 1
            then:
                NewQuestIDs := PickQuests()
                if:
                    set SaveData[InPlayer] = save_data:
                        LastLoginTime := CurrentTime.ToFloat()
                        ActiveQuestIDs := NewQuestIDs
                        MakeSaveData<constructor>(CurrentSaveData)

                for:
                    TrackerElement : QuestTrackers
                do:
                    TrackerElement.Remove(InPlayer)
                for:
                    QuestID : NewQuestIDs
                    TargetTracker := QuestTrackers[QuestID]
                do:
                    TargetTracker.Assign(InPlayer)
            else:
                for:
                    QuestID : CurrentSaveData.ActiveQuestIDs
                    TargetTracker := QuestTrackers[QuestID]
                do:
                    TargetTracker.Assign(InPlayer)

    PickQuests<public>():[]int=
        IDs := 
            for:
                Index := 0..QuestTrackers.Length - 1
            do:
                Index
        IDs.Slice[0, QuestCount] or array{}

    OnBegin<override>()<suspends>:void=
        for:
            PlayerElement : GetPlayspace().GetPlayers()
        do:
            OnPlay(PlayerElement)
        GetPlayspace().PlayerAddedEvent().Subscribe(OnPlay)
        GetPlayspace().PlayerRemovedEvent().Subscribe(OnLeave)

        loop:
            Sleep(1.0)
            for:
                PlayerElement : GetPlayspace().GetPlayers()
            do:
                CheckQuestUpdte(PlayerElement)

    OnPlay(InPlayer:player):void=
        InitializeSaveData(InPlayer)
        CheckQuestUpdte(InPlayer)

    OnLeave(InPlayer:player):void=
        CurrentTime := GetCurrentTimeDate().Today(UpdateHour)
        if:
            CurrentSaveData := SaveData[InPlayer]
            set SaveData[InPlayer] = save_data:
                LastLoginTime := CurrentTime.ToFloat()
                MakeSaveData<constructor>(CurrentSaveData)
        then:
Sign in to download module

Copy-paste each file above is always free.

Comments

    Sign in to vote, comment, or suggest an edit. Sign in
    📄
    Source
    @time_date
    Epic Games Community
    @time_date

    Created by a member of the Epic Games community. Rights remain with the original author, under Epic's community content terms. Terms ↗

    View original Sources & licensing
    Request removal
    Last updated Jun 23, 2026
    Verse module (2 files)
    Compiles · verified Jun 25, 2026

    Download the full module (zip) from the code panel above.

    Keep exploring
    More in Verse Language · 85 of 106
    Prev
    fortnite generic list
    Next
    fortnite number multiplier to percent method
    Related topics
    • Using Fortnite Data Api In Fortnite General
    • Real Time Clock Device Devices
    • Real Time Clock Device Devices
    • Fortnite Live Event Scheduler Verse Language
    • Lego Santas Toy Factory In Unreal Editor For Fortnite Tutorials

    Related

    Open in graph →

    Related topics

    • Using Fortnite Data Api In Fortnite
    • Real Time Clock Device
    • Real Time Clock Device
    • Fortnite Live Event Scheduler
    • Lego Santas Toy Factory In Unreal Editor For Fortnite
    VerseIsland · an archipelago of Verse & UEFN knowledge
    🗺️ Island atlas Learn Guides History About & Press Sources & Licensing Status

    Not affiliated with Epic Games. Fortnite, UEFN, Unreal Engine, and Verse are trademarks of Epic Games, Inc. Content is attributed to its source — see Sources & Licensing.

    🦜

    Scout · your island guide

    The Isle of Verse