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.
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:
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
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]
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))
hi @TCGameStudio ,
Looks like there is a post/article in
The Chicken Test: Verse Code to Check if an Agent is a Fortnite Player or Character
the source code has been extracted using Screen Grab to MS Paint / Crop the code from the video save as file. Import file into MS Snipping Tool then use the Text Conversion tool.
Clicking “Copy Text” and post below
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Fortnite.com/Characters}
using { /Fortnite.com/Playspaces}
using { /UnrealEngine.com/Temporary/UI}
using { /Fortnite.com/UI}
using { /UnrealEngine.com/Temporary/SpatialMath}
# 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
check_if_player := class(creative_device):
#creates a reference to the trigger device, variable name is MyTrigger/
Geditable
MyTrigger : trigger_device - trigger_device(}
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
MyTrigger.TriggeredEvent.Subscribe(CheckStatus) #we reference the trigger device thru the MyTrigger variable, access its method and subscribe or bind to our fx.
# this ?agent assigns to Agent, then queries to assign to ValidAgent, reassigns to Player and calls GetFortNight character. If true, then we know it is.
CheckStatus(Agent :? agent): void =
if(ValidAgent := Agent?, Player := player[ValidAgent], Player.GetFortCharacter[]):
Print("This is a Fortnite Character.")
else:
Print("This is not a Fortnite Character.")
I know that Localize() returns Anonymous[xxx], but have you tried using “< computes >” instead to get the username?
Name<localizes> (Agent:agent)<computes>: message = "{Agent}"
SetBillboardToPlayerName(Billboard : billboard_device, Agent:agent):void=
Billboard.SetText(Name(Agent))
I don’t really know how you want to implement it into your code, but maybe this helps out!
This is against the rules to access and store player names. Currently it is possible to pass agent in messages and ui where it is substituted. So you can still build your custom leaderboards etc.