Is it possible to embed a Tracker widget into another widget (e.g. HUD Message) to freely position it on screen?

Hi dear experts,
I’m currently designing a custom UI for my map and I’m trying to display the player’s Gold in a specific position on the screen (right side).

At the moment, Gold is tracked using a Tracker device, but the Tracker HUD seems limited to the left side of the screen and offers very little positioning control.

From what I understand, devices like Stat Creator and HUD Message allow much more freedom in positioning UI elements anywhere on the screen — however, they don’t natively support continuously changing values like a live Gold amount.

So my question is:
Is there a way to embed or reuse the Tracker HUD widget inside another widget/device (such as HUD Message), so I can display the Gold value with full positioning freedom?
Or alternatively, is there a recommended approach to display a dynamic value like Gold in a fully custom UI layout?

Any guidance would be appreciated :folded_hands:

I hate to be the bearer of bad news, but unfortunately you are right. It is not possible to change the position of the tracker Widget.

You’re better of using a different method, I personally would recommend using Verse since it’s pretty modular and recently Verse released Verse Fields which makes using WidgetBlueprints more easily inside verse and supports easily changing the text inside the widgets.
If you need any help with converting it to verse let me know.

1 Like

You are amazing .. and honestly yes, I don’t have that knowledge to convert that to Verse

Try this code
Make sure before you import this code to create a UI Widget Blueprint named “WB_GoldTracker” and make sure it has a variable inside named “Gold” thats of type int

gold_tracker:=class(creative_device):
    @editable Add1Trigger : trigger_device = trigger_device{}
    @editable Remove1Trigger : trigger_device = trigger_device{}
    var PlayerGold : [agent]int = map{}
    var PlayerSavedUI : [agent]WB_GoldTracker = map{}
    OnBegin<override>()<suspends>:void=
        Playspace:=GetPlayspace()
        for(i:Playspace.GetPlayers()){PlayerEntered(i)}
        Playspace.PlayerAddedEvent().Subscribe(PlayerEntered)
        Add1Trigger.TriggeredEvent.Subscribe(Add1Gold)
        Remove1Trigger.TriggeredEvent.Subscribe(Remove1Gold)

    PlayerEntered(Player:player):void=
        if. set PlayerGold[Player]=0
        if(PlayerUI:=GetPlayerUI[Player]):
            GeneratedUI:=WB_GoldTracker{Gold:=0}
            PlayerUI.AddWidget(GeneratedUI)
            if. set PlayerSavedUI[Player]=GeneratedUI

    Add1Gold(MAgent:?agent):void=
        if(Agent:=MAgent?,_PlayerGold:=PlayerGold[Agent]):
            if. set PlayerGold[Agent]=_PlayerGold+1
            if(GoldTracker:=PlayerSavedUI[Agent]):
                set GoldTracker.Gold=_PlayerGold+1
    
    Remove1Gold(MAgent:?agent):void=
        if(Agent:=MAgent?,_PlayerGold:=PlayerGold[Agent]):
            if(_PlayerGold>0):
                if. set PlayerGold[Agent]=_PlayerGold-1
                if(GoldTracker:=PlayerSavedUI[Agent]):
                    set GoldTracker.Gold=_PlayerGold-1

Afterwards connect the Add1Trigger to a trigger that should increment the counter by 1 and the Remove1Trigger for when the counter of a player should decrease by 1

2 Likes

You are a legend. I’ve used this in UEFN to track 2 different things and display them on screen in a custom UI. I was having a nightmare following tutorials on youtube for hours. Thank you!