UEFN Gun Game for Fortnite, No End Screen/Scoreboard when Game Ends?

So I have little to no experience with coding, but I was watching a Tutorial on how to make a functioning gun game with UEFN and Verse Code. I got it all to work but when the game ends, there’s no scoreboard/end screen, It just ends and the video I was watching didn’t explain how to add one after the game ends. I’ve looked everywhere and haven’t had luck. Does anyone know how to do this to make this work?

VERSE CODE IM USING

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

See Create Your Own Device Using Verse for how to create a verse device.

A Verse-authored creative device that can be placed in a level

Game_Manager_Device := class(creative_device):

# Map data structure that stores players as the key
# and current WeaponTier as the value
var PlayerMap : [player]int = map{}

# Item granters stored in an array so we can give the player
# new weapons
@editable
var WeaponGranters : []item_granter_device = array{}

# Array of bot for beating up and testing
@editable
var Sentries : []sentry_device = array{}

# This is how we end the game later
@editable
EndGameDevice : end_game_device = end_game_device{}

var ElimsToEndGame : int = 20

# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
    set ElimsToEndGame = WeaponGranters.Length;
    InitPlayers()
    InitTestMode()

InitPlayers() : void=
    AllPlayers := GetPlayspace().GetPlayers()
    for (Player : AllPlayers, FortCharacter := Player.GetFortCharacter[]):
        if (set PlayerMap[Player] = 0, WeaponTier := PlayerMap[Player]):
            FortCharacter.EliminatedEvent().Subscribe(OnPlayerEliminated)
            GrantWeapon(Player, WeaponTier)

GrantWeapon(Player : player, WeaponTier: int) : void=
    Print("Attempting to grant weapon")
    if (ItemGranter := WeaponGranters[WeaponTier]):
        Print("Granted item to player")
        ItemGranter.GrantItem(Player)       
        
OnPlayerEliminated(Result : elimination_result) : void=
    Eliminator := Result.EliminatingCharacter
    if (FortCharacter := Eliminator?, EliminatingAgent := FortCharacter.GetAgent[]):
        Print("We need to promote player")

PromotePlayer(Agent : agent) : void=
    var WeaponTier : int = 0
    if (Player := player[Agent], PlayerWeaponTier := PlayerMap[Player]):
        set WeaponTier = PlayerWeaponTier + 1
        CheckEndGame(Agent, WeaponTier)

    if (Player := player[Agent], set PlayerMap[Player] = WeaponTier):
        GrantWeapon(Player, WeaponTier)


InitTestMode() : void=
    for (Sentry : Sentries):
        Sentry.EliminatedEvent.Subscribe(TestPlayerElimination)

TestPlayerElimination(Agent : ?agent) : void=
    Print("Sentry eliminated!")
    if (Player := Agent?):
        PromotePlayer(Player)


CheckEndGame(Player : agent, WeaponTier : int) : void=
    if (WeaponTier >= ElimsToEndGame):
        EndGameDevice.Activate(Player)

I’ve been following the same tutorial (i recognize the code).
I have the end screen and scoreboard show up by using settings in the islandsettings-user options-ui settings.
This gets the end screen and scoreboard to show up but it isnt tracking the player score yet (it does track when the player is eliminated by sentries), i am working on this part now.
I cant be of more help yet, but try googling “uefn end game settings” for now, and add a comment to the tutorial, maybe Mark will make a tutorial on this too.

1 Like