using { /Fortnite.com/Devices } using { /Fortnite.com/Game } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # MUSIC & LOOPS: pump looping music onto the dance floor for every player. # # A Radio Device is built for curated, looping music. The pattern is different # from a one-shot SFX: you REGISTER the agents who should hear it, then Play(). # Here we register every player as they join, so the whole club hears the set, # and we Stop() cleanly if we ever need silence (an intermission, a boss line). music_loop_device := class(creative_device): # Wire a placed Radio Device here. @editable DanceFloorRadio : radio_device = radio_device{} OnBegin() : void = # Register everyone already in the match, then start the music. Players := GetPlayspace().GetPlayers() for (Player : Players): DanceFloorRadio.Register(Player) DanceFloorRadio.Play() Print("Dance floor music started") # Call this to register a late-joiner so they hear the set too. AddListener(Player : agent) : void = DanceFloorRadio.Register(Player) # Drop the beat — silence the whole floor (e.g. for an announcement). KillTheMusic() : void = DanceFloorRadio.Stop()