Verse Library verse

01 Fragment

Tracks player eliminations and prints killer victim messages to a specified message feed device.

verse-library/using-message-feed-devices-in-fortnite-creative/01-fragment.verse

# This is a comment. The computer ignores this.
# Think of it as notes for yourself, like sticky notes on your controller.

using { /Fortnite.com/Devices }

# We define a script called EliminationTracker.
# This script will be attached to a Game Mode or a specific device later.
template EliminationTracker() is game_script()
{
    # 1. FIND THE DEVICE
    # We are looking for a Message Feed device named "MyMessageFeed".
    # If it doesn't exist, the game might crash, so we use "find?" which returns "nothing" if it fails.
    MyFeed := find<MessageFeedDevice>("MyMessageFeed")?

    # 2. DEFINE THE EVENT
    # We want to react when a player eliminates another player.
    # "OnEliminationConfirmed" is the event.
    # "Killer" and "Victim" are variables that hold the player info.
    event OnEliminationConfirmed(Killer: player, Victim: player) -> ()
    {
        # 3. CHECK IF DEVICE EXISTS
        # If MyFeed is valid (we found it), then run the code inside.
        if (MyFeed != nothing)
        {
            # 4. GET THE NAMES
            # Players have a "name" property. We grab it.
            KillerName := Killer.GetPlayerName()
            VictimName := Victim.GetPlayerName()

            # 5. BUILD THE MESSAGE

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in