How to show an ongoing kill streak in the message feed

Hello @Tusiime ! How are you?

That’s a really interesting question! And, as you perfectly suposed, it will be much better if you implement some Verse conde to do it! Let me help you with that!

First of all, you will need three different things:

  1. A User Widget, configured to update its text based on a HUD Message Device (I’ll show you how to configure it later in this post)

  2. HUD Message Device, with the previous widget assigned to it

  3. Elimination Manager, with “Valid on Self Elimination” option set to “True”

Once you have those three things, we can start configuring the Widget!

  1. The first thing you should do, is to add a Canvas to the Widget and then a Text Block. Both things can be done by searching them in the Palette menu and dragging them to the viewport (there are a lot of tutorials on how to do this if you need more info)

  2. Click on “View Bindings” and then on “Add Viewmodel”

  3. In the next screen select “Device - Message View Model” and close the window that appears after that

  4. Select your Text Block in the left menu, click again on View Bindings and then click on “Add Widget Text Block” on the top left corner of that new window. You will end with something like this

  5. Click on the pencil at the right of “Text Block” and choose “Text”, then click on the pencil where says “No field selected” and select “MVVM_UEFN_HUDMessage” and then choose “Text”

  6. Compile and save the widget! And that’s it with it

After doing all this, remember to check if the widget is assigned to the HUD Message Device. And then we can proceed with the Verse code!

Ok, now we need to create a new verse device, there are a lot of tutorials on that so I’ll jump directly to the code! I’ve added a lot of notes to it so you can understand what each part does.

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

kill_counter_device := class(creative_device):
    
    # MAP variable to store the kills for each agent
    var PlayerKills : [agent]int = map{}
    # variables to check if the eliminator is the same as the eliminated to avoid wrong killstreak updates
    var LastEliminator : ?agent = false
    var LastEliminated : ?agent = false

    ## Needed devices
    @editable
    var EliminationManager : elimination_manager_device = elimination_manager_device{}
    
    @editable # HUD device to show the message to all players
    var HudDevice: hud_message_device = hud_message_device{}
    # Define the message to show, adding the player as an agent and the killstreak as an int
    KillstreakText<localizes>(Player: agent, Value: int): message = "{Player} has an elimination streak of {Value}!"

    OnBegin<override>()<suspends>:void = 
        # Subscribe to the Elimination Manager's eliminated and elimination events
        EliminationManager.EliminationEvent.Subscribe(OnPlayerElimination)
        EliminationManager.EliminatedEvent.Subscribe(OnPlayerEliminated)
        # Get all the players in the Island
        for (Agent : GetPlayspace().GetPlayers()):
            InitializeMap(Agent)

    # Function to set the values for each player to 0 at the beginning of the game
    InitializeMap(Agent : agent) : void =
        if (set PlayerKills[Agent] = 0):

    # This function updates the killstreak value for the Eliminator
    OnPlayerElimination(Agent : ?agent) : void =
        # Set the player to the auxiliar variable LastEliminator
        set LastEliminator = Agent
        # Checks if the Eliminator is not the same player as the Eliminated
        if (LastEliminator <> LastEliminated):
            # Get current kills if the Eliminator was a player and is not the same as the Eliminated
            if (Player := player[Agent?]):
                if (CurrentKills := PlayerKills[Player]):
                    # Add new kill to Map values
                    NewKills := CurrentKills + 1
                    if( set PlayerKills[Player] = NewKills ):
                        # Call the UI update function
                        ShowKillToAgent(Player,NewKills)
            # Set both auxiliary variables to false to avoid errors            
            set LastEliminator = false
            set LastEliminated = false

    # This function resets the player's killstreak to 0
    OnPlayerEliminated(Agent : agent) : void =
        # Set the player to the auxiliar variable LastEliminated
        set LastEliminated = option{Agent}
        # Reset that player's killstreak value to 0
        if (set PlayerKills[Agent] = 0):

    # This function shows the killstreak of each players to all the players on the Island
    ShowKillToAgent(Agent: agent, Value: int): void =
        if (Player := player[Agent]):
            # this set the Agent and the Value to the KillstrekText variable and sends it to the HUD Device designated Widget
            HudDevice.SetText(KillstreakText(Agent, Value))
            # this gives the order to the HUD Device to be shown to all players on the Island
            HudDevice.Show()

Just copy and paste that code to the new verse device, save and compile it, and you will be ready to drop the new device on your Island and add the Elimination Manager device and the HUD Message Device to it.

And that’s it! You have your UI working as intended! Of course you will need to custom the Widget and HUD device as you want to improve the aesthetics but that’s on you!

A last quick note is that, if you need to show the “reset killstreak” too, you will need to add a new HUD Device, a new Widget, a new message variable and a new function to the code that you will need to call inside the “OnPlayerEliminated” function. But it’s the same as it is already done for the killstreak!

Hope it helps you!