[Feature request] Get player name in Verse

GetName(Player : player)

Or similar to get players nickname.

This would allow us to make custom score/leader boards with own UI and tracking strategies and many more.

In case you’re looking for a workaround on how to do that now:

1 Like

We do it like this then store the playernames in an array

    var PlayerNames : []message  = array{}
    PlayerNameToMessage<localizes>(Agent:agent):message="{Agent}"

    GetPlayerName(): void=
       
        Players := GetPlayspace().GetPlayers()
            for(found : Players):
                    CurrentPlayerName : message = PlayerNameToMessage(found)
                    set PlayerNames = PlayerNames + array{CurrentPlayerName} 

we store the names as messages rather than strings so we can show them in text blocks

3 Likes

This is dope. Tnx. I hope its not a lucky accident that will break in next updates =D

It seems the nick name is only correct for the player him self, other are shown as Anonymous[XXX] :confused:

Has this been resolved?

Trying to create a top 5 leaderboard, but all the names have Anonymous. It’s totally ridiculous that in order to get a top 5 leader board you need 5 overlapping Billboards. Why doesn’t Epic resolve this?

GetTop5():void=
    AllPlayers := GetPlayspace().GetPlayers()
    var id:int = 0
    var x:playerScore = playerScore{Score:=0}
    Scores:[]playerScore =
        for (Agent : AllPlayers, TeamPlayer := player[Agent]):
            if (Value:=PlayerMap[TeamPlayer]):
                set id += 1
                Value.SetID(id)
                set x = playerScore{Score:=Value.Score, PlayerId:=id}                    
            else:
                set x = playerScore{Score:=0, PlayerId:=0}
    Sorted := Sort(Scores, false, CompareScores)
    var lastIndex:int = Sorted.Length
    if (lastIndex > 5):
        set lastIndex = 5

    var Lines:[]string = array{"","","","",""}
    for (Index := 0..lastIndex - 1):
        if (Item := Sorted[Index]):
            for (Agent : AllPlayers, TeamPlayer := player[Agent]):
                if (Value:=PlayerMap[TeamPlayer]):
                    Pid:=Value.GetID()
                    if:
                        Item.PlayerId = Pid
                    then:
                        S:=Localize(ScoreText(Index + 1, TeamPlayer, "{Item.Score}"))
                        if (set Lines[Index] = S) {}

    if:
        Billboard1:=BillboardRanks[0]
        Billboard2:=BillboardRanks[1]
        First:=Lines[0]
        Second:=Lines[1]
        Third:=Lines[2]
        Fourth:=Lines[3]
        Fifth:=Lines[4]
    then:
        Billboard1.SetText(Top5Text(First, Second, Third, Fourth, Fifth))
        Billboard2.SetText(Top5Text(First, Second, Third, Fourth, Fifth))