Untitled

 avatar
unknown
plain_text
a year ago
1.6 kB
12
Indexable
using { /Fortnite.com/Devices }
using { /Fortnite.com/AI }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }

_BuildMessage<localizes>(String : string) : message = "{String}"
_EmptyMessage<localizes>() : message = ""

BuildMessage(String : string) : message = if(String.Length > 0) then _BuildMessage(String) else _EmptyMessage()

custom_scoreboard := class(creative_device):

    @editable
    TeamOneEliminationDevice : elimination_manager_device = elimination_manager_device{}

    @editable
    TeamTwoEliminationDevice : elimination_manager_device = elimination_manager_device{}

    ScoreboardUI : ui_scoreboard = ui_scoreboard{}

    # Runs when the device is started in a running game
    OnBegin<override>()<suspends>:void=

        # Subscribe to new players joining game
        GetPlayspace().PlayerAddedEvent().Subscribe(ShowUIForPlayer)

        # Show UI for players already in game
        for(ConnectedPlayer : GetPlayspace().GetPlayers()):
            ShowUIForPlayer(ConnectedPlayer)

        TeamOneEliminationDevice.EliminationEvent.Subscribe(OnTeamOneEliminates)
        TeamTwoEliminationDevice.EliminationEvent.Subscribe(OnTeamTwoEliminates)


    OnTeamOneEliminates(MaybeAgent: ?agent):void =
        ScoreboardUI.IncrementScore(0)

    OnTeamTwoEliminates(MaybeAgent: ?agent):void =
        ScoreboardUI.IncrementScore(1)

    ShowUIForPlayer(Player: player):void =
        ScoreboardUI.Show(Player)
Leave a Comment