Does someone know how to get SubscribeRoundEnded working

Does someone know how to get SubscribeRoundEnded working ( in Verse )?

Hey @Rednes1234 how are you?

I’ve been trying for a couple hours to make it work but I couldn’t. You need to subscribe to that event for the Round Manager but I couldn’t find a way to get that Roound Manager in Verse, as you need an entity that contains it and get it from there.

This is what I’ve been testing so far:

1) Approach with Round Settings device:

using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Fortnite.com/Playspaces }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /Verse.org/Assets }
using { /Verse.org/SceneGraph }
using { /UnrealEngine.com/Temporary/Diagnostics }

# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.

# A Verse-authored creative device that can be placed in a level
end_of_round_manager2 := class(creative_device):

    @editable
    RoundSettings : round_settings_device = round_settings_device{}

    var RoundEndedSubscription: ?cancelable = false

    OnBegin<override>()<suspends>: void =
        Print("Starting to listen the end of round")
        if(DeviceEntity := entity[RoundSettings]):
            if (RoundManager := DeviceEntity.GetFortRoundManager[]):
                Print("✅ Round Manager found from Round Settings Device")
                RoundManager.SubscribeRoundEnded(OnRoundEnded)
            else:
                Print("❌ No Round Manager found from Round Settings Device")
        else:
            Print("Device's entity not found")

    OnRoundEnded(): void =
        Print("💥 Round is Over!")

2) Approach with players:


using { /Fortnite.com/Devices }
using { /Fortnite.com/Game }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Fortnite.com/Characters }
using { /Verse.org/Assets }
using { /Verse.org/SceneGraph }

# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.

# A Verse-authored creative device that can be placed in a level
end_of_round_manager := class(creative_device):

    # Runs when the device is started in a running game
    OnBegin<override>()<suspends>: void =
        Players := GetPlayspace().GetPlayers()
        if(Players.Length > 0):
            if(FirstPlayer := Players[0]):
                if(PlayerEntity := entity[FirstPlayer]):
                    if(RoundManager := PlayerEntity.GetFortRoundManager[]):
                        Print("✅ Round Manager found from the first player")
                        RoundManager.SubscribeRoundEnded(OnRoundEnded)
                    else:
                        Print("❌ No Round Manager found from first player")
    
    OnRoundEnded(): void =
        Print("💥 Round is Over!")

I don’t know if it possible to use that function right now in verse but if you tell me what are you trying to do I could probably help you with a different method to achieve the same result!

I’ll be waiting for your answer!